2017 © Pedro Peláez
 

lithium-library li3_unit

Adds extra assert methods and simple ways to create models, controllers, and helpers.

image

blainesch/li3_unit

Adds extra assert methods and simple ways to create models, controllers, and helpers.

  • Monday, November 26, 2012
  • by BlaineSch
  • Repository
  • 1 Watchers
  • 4 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

li3_unit - Lithium PHP

Adds extra assert methods and simple ways to create models, controllers, and helpers., (*1)

Build Status, (*2)

Installation

Composer

~~~ json { "require": { ... "composer/installers": "*", "blainesch/li3_unit": ">=1.0.0" ... } }, (*3)

~~~ bash
php composer.phar install

Submodule

~~~ bash git submodule add git://github.com/blainesch/li3_unit.git libraries/li3_unit, (*4)


### Clone Directly ~~~ bash git clone git://github.com/blainesch/li3_unit.git libraries/li3_unit

Usage

Load the plugin

Add the plugin to be loaded with Lithium's autoload magic, (*5)

In app/config/bootstrap/libraries.php add:, (*6)

~~~ php , (*7)


### Extra Assertions Currently tests extend \lithium\test\Unit instead, extend \li3_unit\test\Unit which extends the default lithium Unit this gives you access to new assertion methods. To read up on all the different assertions visit the [assertions.md](https://github.com/BlaineSch/li3_unit/blob/master/assertions.md) file. ~~~ php assertCount(3, array('foo', 'bar', 'baz')); } } ?>

Calling a controller

Instead of extending our built-in Unit class, extend ControllerUnit. You still have access to all of the extra assertion methods and Lithium's built in features, but also have access to a new 'call' method. ~~~ php call('profile', array( 'params' => array( 'name' => 'Blaine', ) )); $user = $data['user']; $this->assertEqual('Blaine', $user->username); } } ?>, (*8)


### Calling a helper Similar to before we will change ControllerUnit to HelperUnit and have access to a new method 'create' which will help create new helpers for us to test against. ~~~ php prose = $this->create('Prose'); } public function testFourEightStarStatement() { $expected = 'Amazing'; $this->assertEqual($expected, $this->prose->starStatement(4.8)); } } ?>

Calling a model

You're probably better off using a library such as li3_fixtures, but for those of us just wanting a one-in-all package this library can help test non-relational model instance methods. ~~~ php '10', 'fname' => 'Blaine', 'lname' => 'Smith', ); public function testName() { $user = $this->create(array( 'fname' => 'Blaine', 'lname' => 'Schmeisser', )); $expected = 'Blaine Schmeisser'; $this->assertEqual($expected, $user->fullName()); } } ?> ~~~, (*9)

The Versions

26/11 2012

dev-master

9999999-dev https://github.com/BlaineSch/li3_unit

Adds extra assert methods and simple ways to create models, controllers, and helpers.

  Sources   Download

The BSD License

test testing unit testing unit lithium li3

26/11 2012

v1.0.1

1.0.1.0 https://github.com/BlaineSch/li3_unit

Adds extra assert methods and simple ways to create models, controllers, and helpers.

  Sources   Download

The BSD License

test testing unit testing unit lithium li3

24/11 2012

v1.0.0

1.0.0.0 https://github.com/BlaineSch/li3_unit

Adds extra assert methods and simple ways to create models, controllers, and helpers.

  Sources   Download

The BSD License

test testing unit testing unit lithium li3