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
파일 보기 프로젝트 열기: unionofrad/lithium

보호된 프로퍼티들

프로퍼티 타입 설명
$_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