PHP Класс Ouzo\Tests\Assert

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

that() публичный статический Метод

Sample usage: Assert::that($object)->isInstanceOf(Controller::class);
public static that ( mixed $subject ) : GeneralAssert
$subject mixed
Результат GeneralAssert

thatArray() публичный статический Метод

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
Результат ArrayAssert

thatBool() публичный статический Метод

Sample usage: Assert::thatBool(isCool())->isTrue();
public static thatBool ( string $string ) : BooleanAssert
$string string
Результат BooleanAssert

thatModel() публичный статический Метод

Sample usage: Assert::thatModel(new User(['name' => 'bob']))->hasSameAttributesAs(new User(['name' => 'bob']));
public static thatModel ( Model $actual ) : ModelAssert
$actual Ouzo\Model
Результат ModelAssert

thatSession() публичный статический Метод

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

thatString() публичный статический Метод

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
Результат Ouzo\Tests\StringAssert