PHP 클래스 Mockery\Expectation

상속: implements mockery\ExpectationInterface
파일 보기 프로젝트 열기: padraic/mockery 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_actualCount integer Actual count of calls to this expectation
$_closureQueue array Array of closures executed with given arguments to generate a result to be returned
$_countValidatorClass string The count validator class to use
$_countValidators array Count validator store
$_expectedArgs array Arguments expected by this expectation
$_globalOrderNumber integer Integer representing the call order of this expectation on a global basis
$_globally boolean Flag indicating whether the order of calling is determined locally or globally
$_mock object Mock object to which this expectation belongs
$_name string Method name
$_noArgsExpectation boolean Flag indicating we expect no arguments
$_orderNumber integer Integer representing the call order of this expectation
$_passthru boolean Flag indicating if the return value should be obtained from the original class method instead of returning predefined values from the return queue
$_returnQueue array Array of return values as a queue for multiple return sequence
$_returnValue mixed Value to return from this expectation
$_setQueue array Array of values to be set when this expectation matches
$_throw boolean Flag indicating that an exception is expected to be throw (not returned)

공개 메소드들

메소드 설명
__clone ( ) Cloning logic
__construct ( Mockery\MockInterface $mock, string $name ) Constructor
__toString ( ) : string Return a string with the method name and arguments formatted
andReturn ( ) : self Set a return value, or sequential queue of return values
andReturnFalse ( )
andReturnNull ( ) : self Return null. This is merely a language construct for Mock describing.
andReturnSelf ( ) : self Return this mock, like a fluent interface
andReturnTrue ( )
andReturnUndefined ( ) : self Return a self-returning black hole object.
andReturnUsing ( ) : self Set a closure or sequence of closures with which to generate return values. The arguments passed to the expected method are passed to the closures as parameters.
andReturnValues ( array $values ) : self Set a sequential queue of return values with an array
andSet ( string $name, mixed $value ) : self Register values to be set to a public property each time this expectation occurs
andThrow ( string | Exception $exception, string $message = '', integer $code, Exception $previous = null ) : self Set Exception class and arguments to that class to be thrown
andThrowExceptions ( array $exceptions ) : self Set Exception classes to be thrown
atLeast ( ) : self Sets next count validator to the AtLeast instance
atMost ( ) : self Sets next count validator to the AtMost instance
between ( integer $minimum, integer $maximum ) Shorthand for setting minimum and maximum constraints on call counts
byDefault ( ) : self Mark this expectation as being a default
getMock ( ) : Mockery\MockInterface Return the parent mock of the expectation
getName ( )
getOrderNumber ( ) : integer Return order number
globally ( ) : self Indicates call order should apply globally
isCallCountConstrained ( ) : boolean Check if there is a constraint on call count
isEligible ( ) : boolean Checks if this expectation is eligible for additional calls
matchArgs ( array $args ) : boolean Check if passed arguments match an argument expectation
never ( ) : self Indicates that this expectation is never expected to be called
once ( ) : self Indicates that this expectation is expected exactly once
ordered ( string $group = null ) : self Indicates that this expectation must be called in a specific given order
passthru ( ) : self Flag this expectation as calling the original class method with the any provided arguments instead of using a return value queue.
set ( string $name, mixed $value ) : self Alias to andSet(). Allows the natural English construct - set('foo', 'bar')->andReturn('bar')
times ( integer $limit = null ) : self Indicates the number of times this expectation should occur
twice ( ) : self Indicates that this expectation is expected exactly twice
validateOrder ( ) : void Verify call order
verify ( ) : boolean Verify this expectation
verifyCall ( array $args ) : mixed Verify the current call, i.e. that the given arguments match those of this expectation
with ( ) : self Expected argument setter for the expectation
withAnyArgs ( ) : self Set expectation that any arguments are acceptable
withArgs ( array | Closur\Closure $argsOrClosure ) : self Expected arguments for the expectation passed as an array or a closure that matches each passed argument on each function call.
withNoArgs ( ) : self Set with() as no arguments expected
zeroOrMoreTimes ( ) : self Indicates this expectation should occur zero or more times

보호된 메소드들

메소드 설명
_defineOrdered ( string $group, object $ordering ) : integer Setup the ordering tracking on the mock or mock container
_getReturnValue ( array $args ) : mixed Fetch the return value for the matching args
_matchArg ( mixed $expected, &$actual ) : boolean Check if passed argument matches an argument expectation
_setValues ( ) : mixed Sets public properties with queued values to the mock object

비공개 메소드들

메소드 설명
isMultiArgumentClosureExpectation ( ) : boolean Check if the registered expectation is a MultiArgumentClosureExpectation.
withArgsInArray ( array $arguments ) : self Expected arguments for the expectation passed as an array
withArgsMatchedByClosure ( Closur\Closure $closure ) : self Expected arguments have to be matched by the given closure.

메소드 상세

__clone() 공개 메소드

Cloning logic
public __clone ( )

__construct() 공개 메소드

Constructor
public __construct ( Mockery\MockInterface $mock, string $name )
$mock Mockery\MockInterface
$name string

__toString() 공개 메소드

Return a string with the method name and arguments formatted
public __toString ( ) : string
리턴 string

_defineOrdered() 보호된 메소드

Setup the ordering tracking on the mock or mock container
protected _defineOrdered ( string $group, object $ordering ) : integer
$group string
$ordering object
리턴 integer

_getReturnValue() 보호된 메소드

Fetch the return value for the matching args
protected _getReturnValue ( array $args ) : mixed
$args array
리턴 mixed

_matchArg() 보호된 메소드

Check if passed argument matches an argument expectation
protected _matchArg ( mixed $expected, &$actual ) : boolean
$expected mixed
리턴 boolean

_setValues() 보호된 메소드

Sets public properties with queued values to the mock object
protected _setValues ( ) : mixed
리턴 mixed

andReturn() 공개 메소드

Set a return value, or sequential queue of return values
public andReturn ( ) : self
리턴 self

andReturnFalse() 공개 메소드

public andReturnFalse ( )

andReturnNull() 공개 메소드

Return null. This is merely a language construct for Mock describing.
public andReturnNull ( ) : self
리턴 self

andReturnSelf() 공개 메소드

Return this mock, like a fluent interface
public andReturnSelf ( ) : self
리턴 self

andReturnTrue() 공개 메소드

public andReturnTrue ( )

andReturnUndefined() 공개 메소드

Return a self-returning black hole object.
public andReturnUndefined ( ) : self
리턴 self

andReturnUsing() 공개 메소드

Set a closure or sequence of closures with which to generate return values. The arguments passed to the expected method are passed to the closures as parameters.
public andReturnUsing ( ) : self
리턴 self

andReturnValues() 공개 메소드

Set a sequential queue of return values with an array
public andReturnValues ( array $values ) : self
$values array
리턴 self

andSet() 공개 메소드

Register values to be set to a public property each time this expectation occurs
public andSet ( string $name, mixed $value ) : self
$name string
$value mixed
리턴 self

andThrow() 공개 메소드

Set Exception class and arguments to that class to be thrown
public andThrow ( string | Exception $exception, string $message = '', integer $code, Exception $previous = null ) : self
$exception string | Exception
$message string
$code integer
$previous Exception
리턴 self

andThrowExceptions() 공개 메소드

Set Exception classes to be thrown
public andThrowExceptions ( array $exceptions ) : self
$exceptions array
리턴 self

atLeast() 공개 메소드

Sets next count validator to the AtLeast instance
public atLeast ( ) : self
리턴 self

atMost() 공개 메소드

Sets next count validator to the AtMost instance
public atMost ( ) : self
리턴 self

between() 공개 메소드

Shorthand for setting minimum and maximum constraints on call counts
public between ( integer $minimum, integer $maximum )
$minimum integer
$maximum integer

byDefault() 공개 메소드

Mark this expectation as being a default
public byDefault ( ) : self
리턴 self

getMock() 공개 메소드

Return the parent mock of the expectation
public getMock ( ) : Mockery\MockInterface
리턴 Mockery\MockInterface

getName() 공개 메소드

public getName ( )

getOrderNumber() 공개 메소드

Return order number
public getOrderNumber ( ) : integer
리턴 integer

globally() 공개 메소드

Indicates call order should apply globally
public globally ( ) : self
리턴 self

isCallCountConstrained() 공개 메소드

Check if there is a constraint on call count
public isCallCountConstrained ( ) : boolean
리턴 boolean

isEligible() 공개 메소드

Checks if this expectation is eligible for additional calls
public isEligible ( ) : boolean
리턴 boolean

matchArgs() 공개 메소드

Check if passed arguments match an argument expectation
public matchArgs ( array $args ) : boolean
$args array
리턴 boolean

never() 공개 메소드

Indicates that this expectation is never expected to be called
public never ( ) : self
리턴 self

once() 공개 메소드

Indicates that this expectation is expected exactly once
public once ( ) : self
리턴 self

ordered() 공개 메소드

Indicates that this expectation must be called in a specific given order
public ordered ( string $group = null ) : self
$group string Name of the ordered group
리턴 self

passthru() 공개 메소드

Flag this expectation as calling the original class method with the any provided arguments instead of using a return value queue.
public passthru ( ) : self
리턴 self

set() 공개 메소드

Alias to andSet(). Allows the natural English construct - set('foo', 'bar')->andReturn('bar')
public set ( string $name, mixed $value ) : self
$name string
$value mixed
리턴 self

times() 공개 메소드

Indicates the number of times this expectation should occur
public times ( integer $limit = null ) : self
$limit integer
리턴 self

twice() 공개 메소드

Indicates that this expectation is expected exactly twice
public twice ( ) : self
리턴 self

validateOrder() 공개 메소드

Verify call order
public validateOrder ( ) : void
리턴 void

verify() 공개 메소드

Verify this expectation
public verify ( ) : boolean
리턴 boolean

verifyCall() 공개 메소드

Verify the current call, i.e. that the given arguments match those of this expectation
public verifyCall ( array $args ) : mixed
$args array
리턴 mixed

with() 공개 메소드

Expected argument setter for the expectation
public with ( ) : self
리턴 self

withAnyArgs() 공개 메소드

Set expectation that any arguments are acceptable
public withAnyArgs ( ) : self
리턴 self

withArgs() 공개 메소드

Expected arguments for the expectation passed as an array or a closure that matches each passed argument on each function call.
public withArgs ( array | Closur\Closure $argsOrClosure ) : self
$argsOrClosure array | Closur\Closure
리턴 self

withNoArgs() 공개 메소드

Set with() as no arguments expected
public withNoArgs ( ) : self
리턴 self

zeroOrMoreTimes() 공개 메소드

Indicates this expectation should occur zero or more times
public zeroOrMoreTimes ( ) : self
리턴 self

프로퍼티 상세

$_actualCount 보호되어 있는 프로퍼티

Actual count of calls to this expectation
protected int $_actualCount
리턴 integer

$_closureQueue 보호되어 있는 프로퍼티

Array of closures executed with given arguments to generate a result to be returned
protected array $_closureQueue
리턴 array

$_countValidatorClass 보호되어 있는 프로퍼티

The count validator class to use
protected string $_countValidatorClass
리턴 string

$_countValidators 보호되어 있는 프로퍼티

Count validator store
protected array $_countValidators
리턴 array

$_expectedArgs 보호되어 있는 프로퍼티

Arguments expected by this expectation
protected array $_expectedArgs
리턴 array

$_globalOrderNumber 보호되어 있는 프로퍼티

Integer representing the call order of this expectation on a global basis
protected int $_globalOrderNumber
리턴 integer

$_globally 보호되어 있는 프로퍼티

Flag indicating whether the order of calling is determined locally or globally
protected bool $_globally
리턴 boolean

$_mock 보호되어 있는 프로퍼티

Mock object to which this expectation belongs
protected object $_mock
리턴 object

$_name 보호되어 있는 프로퍼티

Method name
protected string $_name
리턴 string

$_noArgsExpectation 보호되어 있는 프로퍼티

Flag indicating we expect no arguments
protected bool $_noArgsExpectation
리턴 boolean

$_orderNumber 보호되어 있는 프로퍼티

Integer representing the call order of this expectation
protected int $_orderNumber
리턴 integer

$_passthru 보호되어 있는 프로퍼티

Flag indicating if the return value should be obtained from the original class method instead of returning predefined values from the return queue
protected bool $_passthru
리턴 boolean

$_returnQueue 보호되어 있는 프로퍼티

Array of return values as a queue for multiple return sequence
protected array $_returnQueue
리턴 array

$_returnValue 보호되어 있는 프로퍼티

Value to return from this expectation
protected mixed $_returnValue
리턴 mixed

$_setQueue 보호되어 있는 프로퍼티

Array of values to be set when this expectation matches
protected array $_setQueue
리턴 array

$_throw 보호되어 있는 프로퍼티

Flag indicating that an exception is expected to be throw (not returned)
protected bool $_throw
리턴 boolean