PHP Класс lithium\test\MockerChain

Asserting if method1 was not called $mock = new \lithium\tests\mocks\test\mockStdClass\Mock(); $this->assertFalse(Mocker::chain($mock)->called('method1')->success()); Asserting if method1 was called 2 times $mock = new \lithium\tests\mocks\test\mockStdClass\Mock(); $this->assertTrue(Mocker::chain($mock)->called('method1')->eq(2)->success()); Asserting if method2 was called after method1 $mock = new \lithium\tests\mocks\test\mockStdClass\Mock(); $this->assertTrue(Mocker::chain($mock)->called('method1')->called('method2')->success()); Asserting if method2 was called after method1, and method2 had specific arguments. $mock = new \lithium\tests\mocks\test\mockStdClass\Mock(); $this->assertTrue(Mocker::chain($mock) ->called('method1') ->called('method2')->with('foo', 'bar') ->success());
Наследование: extends lithium\core\Object
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_data array results Cached mock results method Method we are asserting args Args we are asserting success Success flag callTime Last method call

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

Метод Описание
__call ( string $comparison, array $args ) : object Validates that a given methodis called a set number of times.
__construct ( array $results ) : void Constructor. Saves the results from the mock.
called ( string $method ) : object Valides the method was called after the last call.
respondsTo ( string $method, boolean $internal = false ) : boolean Determines if a given method can be called.
success ( ) : boolean Gives back the success flag
with ( ) : object Will further narrow down the original 'called' method.

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

__call() публичный Метод

Validates that a given methodis called a set number of times.
public __call ( string $comparison, array $args ) : object
$comparison string Comparison type 'gt', 'gte', 'lt', 'lte', or 'eq'.
$args array The first argument is the expected result.
Результат object

__construct() публичный Метод

Constructor. Saves the results from the mock.
public __construct ( array $results ) : void
$results array Results from the mock
Результат void

called() публичный Метод

Valides the method was called after the last call.
public called ( string $method ) : object
$method string Method to assert
Результат object

respondsTo() публичный Метод

Determines if a given method can be called.
public respondsTo ( string $method, boolean $internal = false ) : boolean
$method string Name of the method.
$internal boolean Provide `true` to perform check from inside the class/object. When `false` checks also for public visibility; defaults to `false`.
Результат boolean Returns `true` if the method can be called, `false` otherwise.

success() публичный Метод

Gives back the success flag
public success ( ) : boolean
Результат boolean

with() публичный Метод

Valides the cached method name was called with these args
public with ( ) : object
Результат object

Описание свойств

$_data защищенное свойство

results Cached mock results method Method we are asserting args Args we are asserting success Success flag callTime Last method call
protected array $_data
Результат array