PHP Class ouzo\tests\Assert

Show file Open project: letsdrink/ouzo Class Usage Examples

Public Methods

Method Description
that ( mixed $subject ) : GeneralAssert Fluent custom primitives' and objects' assertion to simplify your tests.
thatArray ( array $actual ) : ArrayAssert Fluent custom array assertion to simplify your tests.
thatBool ( string $string ) : BooleanAssert Fluent custom boolean assertion to simplify your tests.
thatModel ( Model $actual ) : ModelAssert Fluent custom model assertion to simplify your tests.
thatSession ( ) Fluent custom session assertion to simplify your tests.
thatString ( string $string ) : Ouzo\Tests\StringAssert Fluent custom string assertion to simplify your tests.

Method Details

that() public static method

Sample usage: Assert::that($object)->isInstanceOf(Controller::class);
public static that ( mixed $subject ) : GeneralAssert
$subject mixed
return GeneralAssert

thatArray() public static method

Sample usage: $animals = array('cat', 'dog', 'pig'); Assert::thatArray($animals)->hasSize(3)->contains('cat'); Assert::thatArray($animals)->containsOnly('pig', 'dog', 'cat'); Assert::thatArray($animals)->containsExactly('cat', 'dog', 'pig'); Assert::thatArray(array('id' => 123, 'name' => 'john'))->containsKeyAndValue(array('id' => 123));
public static thatArray ( array $actual ) : ArrayAssert
$actual array
return ArrayAssert

thatBool() public static method

Sample usage: Assert::thatBool(isCool())->isTrue();
public static thatBool ( string $string ) : BooleanAssert
$string string
return BooleanAssert

thatModel() public static method

Sample usage: Assert::thatModel(new User(['name' => 'bob']))->hasSameAttributesAs(new User(['name' => 'bob']));
public static thatModel ( Model $actual ) : ModelAssert
$actual Ouzo\Model
return ModelAssert

thatSession() public static method

Sample usage: Session::push('key1', 'key2', 'value1'); Assert::thatSession()->hasSize(1)->contains('value1'); Class Assert
public static thatSession ( )

thatString() public static method

Sample usage: Assert::thatString("Frodo")->startsWith("Fro")->endsWith("do")->contains("rod")->doesNotContain("fro")->hasSize(5)->matches('/Fro\w+/');
public static thatString ( string $string ) : Ouzo\Tests\StringAssert
$string string
return Ouzo\Tests\StringAssert