PHP 클래스 Mockery\Mock

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

보호된 프로퍼티들

프로퍼티 타입 설명
$_mockery_allocatedOrder integer Order number of allocation
$_mockery_allowMockingProtectedMethods
$_mockery_container Container Mock container containing this mock object
$_mockery_currentOrder integer Current ordered number
$_mockery_defaultReturnValue mixed If shouldIgnoreMissing is called, this value will be returned on all calls to missing methods
$_mockery_deferMissing boolean Flag to indicate whether we can defer method calls missing from our expectations
$_mockery_disableExpectationMatching boolean Flag to indicate we should ignore all expectations temporarily. Used mainly to prevent expectation matching when in the middle of a mock object recording session.
$_mockery_expectations array Stores an array of all expectation directors for this mock
$_mockery_expectations_count integer Stores an inital number of expectations that can be manipulated while using the getter method.
$_mockery_groups array Ordered groups
$_mockery_ignoreMissing boolean Flag to indicate whether we can ignore method calls missing from our expectations
$_mockery_methods ReflectionMethod[] Just a local cache for this mock's target's methods
$_mockery_mockableMethods array
$_mockery_mockableProperties array Stores all stubbed public methods separate from any on-object public properties that may exist.
$_mockery_name string Given name of the mock
$_mockery_partial object Instance of a core object on which methods are called in the event it has been set, and an expectation for one of the object's methods does not exist. This implements a simple partial mock proxy system.
$_mockery_receivedMethodCalls
$_mockery_verified boolean Flag to indicate whether this mock was verified

공개 메소드들

메소드 설명
__call ( $method, array $args ) Capture calls to this mock
__callStatic ( $method, array $args )
__destruct ( )
__isset ( $name )
__toString ( ) Forward calls to this magic method to the __call method
__wakeup ( )
asUndefined ( )
byDefault ( ) : self In the event shouldReceive() accepting one or more methods/returns, this method will switch them from normal expectations to default expectations
makePartial ( ) : Mock Create an obviously worded alias to shouldDeferMissing()
mockery_allocateOrder ( ) : integer Fetch the next available allocation order number
mockery_callSubjectMethod ( string $name, array $args ) : mixed Calls a parent class method and returns the result. Used in a passthru expectation where a real return value is required while still taking advantage of expectation matching and call count verification.
mockery_findExpectation ( $method, array $args ) : Expectation | null Find an expectation matching the given method and arguments
mockery_getContainer ( ) : Container Return the container for this mock
mockery_getCurrentOrder ( ) : integer Get current ordered number
mockery_getExpectationCount ( ) : integer Gets the count of expectations for this mock
mockery_getExpectations ( )
mockery_getExpectationsFor ( $method ) : Mockery\ExpectationDirector | null Return the expectations director for the given method
mockery_getGroups ( ) : array Fetch array of ordered groups
mockery_getMethod ( $name )
mockery_getMockableMethods ( ) : string[]
mockery_getMockableProperties ( ) : array
mockery_getName ( ) : string Return the name for this mock
mockery_init ( Container $container = null, object $partialObject = null ) : void We want to avoid constructors since class is copied to Generator.php for inclusion on extending class definitions.
mockery_isAnonymous ( ) : boolean
mockery_returnValueForMethod ( string $name ) : mixed
mockery_setCurrentOrder ( integer $order ) Set current ordered number
mockery_setExpectationsFor ( $method, Mockery\ExpectationDirector $director ) : Mockery\ExpectationDirector | null Return the expectations director for the given method
mockery_setGroup ( mixed $group, integer $order ) Set ordering for a group
mockery_teardown ( ) : void Tear down tasks for this mock
mockery_validateOrder ( string $method, integer $order ) : void Validate the current mock's ordering
mockery_verify ( ) : void Iterate across all expectation directors and validate each
shouldAllowMockingMethod ( String $method ) : Mock Allows additional methods to be mocked that do not explicitly exist on mocked class
shouldAllowMockingProtectedMethods ( ) : Mock
shouldDeferMissing ( ) : Mock Set mock to defer unexpected methods to it's parent
shouldExpect ( Closure $closure ) Accepts a closure which is executed with an object recorder which proxies to the partial source object. The intent being to record the interactions of a concrete object as a set of expectations on the current mock object. The partial may then be passed to a second process to see if it fulfils the same (or exact same) contract as the original.
shouldHaveReceived ( $method, $args = null )
shouldIgnoreMissing ( mixed $returnValue = null ) : Mock Set mock to ignore unexpected methods and return Undefined class
shouldNotHaveReceived ( $method, $args = null )
shouldNotReceive ( $methodName ) : Expectation Shortcut method for setting an expectation that a method should not be called.
shouldReceive ( $methodName ) : Expectation Set expected method calls

보호된 메소드들

메소드 설명
_mockery_getReceivedMethodCalls ( )
_mockery_handleMethodCall ( $method, array $args )
_mockery_handleStaticMethodCall ( $method, array $args )
mockery_getMethods ( ) : array Uses reflection to get the list of all methods within the current mock object

비공개 메소드들

메소드 설명
getNonPublicMethods ( ) : array
hasMethodOverloadingInParentClass ( )

메소드 상세

__call() 공개 메소드

Capture calls to this mock
public __call ( $method, array $args )
$args array

__callStatic() 공개 정적인 메소드

public static __callStatic ( $method, array $args )
$args array

__destruct() 공개 메소드

public __destruct ( )

__isset() 공개 메소드

public __isset ( $name )

__toString() 공개 메소드

Forward calls to this magic method to the __call method
public __toString ( )

__wakeup() 공개 메소드

public __wakeup ( )

_mockery_getReceivedMethodCalls() 보호된 메소드

_mockery_handleMethodCall() 보호된 메소드

protected _mockery_handleMethodCall ( $method, array $args )
$args array

_mockery_handleStaticMethodCall() 보호된 정적인 메소드

protected static _mockery_handleStaticMethodCall ( $method, array $args )
$args array

asUndefined() 공개 메소드

public asUndefined ( )

byDefault() 공개 메소드

In the event shouldReceive() accepting one or more methods/returns, this method will switch them from normal expectations to default expectations
public byDefault ( ) : self
리턴 self

makePartial() 공개 메소드

Create an obviously worded alias to shouldDeferMissing()
public makePartial ( ) : Mock
리턴 Mock

mockery_allocateOrder() 공개 메소드

Fetch the next available allocation order number
public mockery_allocateOrder ( ) : integer
리턴 integer

mockery_callSubjectMethod() 공개 메소드

Calls a parent class method and returns the result. Used in a passthru expectation where a real return value is required while still taking advantage of expectation matching and call count verification.
public mockery_callSubjectMethod ( string $name, array $args ) : mixed
$name string
$args array
리턴 mixed

mockery_findExpectation() 공개 메소드

Find an expectation matching the given method and arguments
public mockery_findExpectation ( $method, array $args ) : Expectation | null
$args array
리턴 Expectation | null

mockery_getContainer() 공개 메소드

Return the container for this mock
public mockery_getContainer ( ) : Container
리턴 Container

mockery_getCurrentOrder() 공개 메소드

Get current ordered number

mockery_getExpectationCount() 공개 메소드

Gets the count of expectations for this mock

mockery_getExpectations() 공개 메소드

mockery_getExpectationsFor() 공개 메소드

Return the expectations director for the given method
public mockery_getExpectationsFor ( $method ) : Mockery\ExpectationDirector | null
리턴 Mockery\ExpectationDirector | null

mockery_getGroups() 공개 메소드

Fetch array of ordered groups
public mockery_getGroups ( ) : array
리턴 array

mockery_getMethod() 공개 메소드

public mockery_getMethod ( $name )

mockery_getMethods() 보호된 메소드

Uses reflection to get the list of all methods within the current mock object
protected mockery_getMethods ( ) : array
리턴 array

mockery_getMockableMethods() 공개 메소드

public mockery_getMockableMethods ( ) : string[]
리턴 string[]

mockery_getMockableProperties() 공개 메소드

mockery_getName() 공개 메소드

Return the name for this mock
public mockery_getName ( ) : string
리턴 string

mockery_init() 공개 메소드

We want to avoid constructors since class is copied to Generator.php for inclusion on extending class definitions.
public mockery_init ( Container $container = null, object $partialObject = null ) : void
$container Container
$partialObject object
리턴 void

mockery_isAnonymous() 공개 메소드

public mockery_isAnonymous ( ) : boolean
리턴 boolean

mockery_returnValueForMethod() 공개 메소드

public mockery_returnValueForMethod ( string $name ) : mixed
$name string Method name.
리턴 mixed Generated return value based on the declared return value of the named method.

mockery_setCurrentOrder() 공개 메소드

Set current ordered number
public mockery_setCurrentOrder ( integer $order )
$order integer

mockery_setExpectationsFor() 공개 메소드

Return the expectations director for the given method
public mockery_setExpectationsFor ( $method, Mockery\ExpectationDirector $director ) : Mockery\ExpectationDirector | null
$director Mockery\ExpectationDirector
리턴 Mockery\ExpectationDirector | null

mockery_setGroup() 공개 메소드

Set ordering for a group
public mockery_setGroup ( mixed $group, integer $order )
$group mixed
$order integer

mockery_teardown() 공개 메소드

Tear down tasks for this mock
public mockery_teardown ( ) : void
리턴 void

mockery_validateOrder() 공개 메소드

Validate the current mock's ordering
public mockery_validateOrder ( string $method, integer $order ) : void
$method string
$order integer
리턴 void

mockery_verify() 공개 메소드

Iterate across all expectation directors and validate each
public mockery_verify ( ) : void
리턴 void

shouldAllowMockingMethod() 공개 메소드

Allows additional methods to be mocked that do not explicitly exist on mocked class
public shouldAllowMockingMethod ( String $method ) : Mock
$method String name of the method to be mocked
리턴 Mock

shouldAllowMockingProtectedMethods() 공개 메소드

public shouldAllowMockingProtectedMethods ( ) : Mock
리턴 Mock

shouldDeferMissing() 공개 메소드

This is particularly useless for this class, as it doesn't have a parent, but included for completeness
public shouldDeferMissing ( ) : Mock
리턴 Mock

shouldExpect() 공개 메소드

Accepts a closure which is executed with an object recorder which proxies to the partial source object. The intent being to record the interactions of a concrete object as a set of expectations on the current mock object. The partial may then be passed to a second process to see if it fulfils the same (or exact same) contract as the original.
public shouldExpect ( Closure $closure )
$closure Closure

shouldHaveReceived() 공개 메소드

public shouldHaveReceived ( $method, $args = null )

shouldIgnoreMissing() 공개 메소드

Set mock to ignore unexpected methods and return Undefined class
public shouldIgnoreMissing ( mixed $returnValue = null ) : Mock
$returnValue mixed the default return value for calls to missing functions on this mock
리턴 Mock

shouldNotHaveReceived() 공개 메소드

public shouldNotHaveReceived ( $method, $args = null )

shouldNotReceive() 공개 메소드

Shortcut method for setting an expectation that a method should not be called.
public shouldNotReceive ( $methodName ) : Expectation
리턴 Expectation

shouldReceive() 공개 메소드

Set expected method calls
public shouldReceive ( $methodName ) : Expectation
리턴 Expectation

프로퍼티 상세

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

Order number of allocation
protected int $_mockery_allocatedOrder
리턴 integer

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

protected $_mockery_allowMockingProtectedMethods

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

Mock container containing this mock object
protected Container,Mockery $_mockery_container
리턴 Container

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

Current ordered number
protected int $_mockery_currentOrder
리턴 integer

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

If shouldIgnoreMissing is called, this value will be returned on all calls to missing methods
protected mixed $_mockery_defaultReturnValue
리턴 mixed

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

Flag to indicate whether we can defer method calls missing from our expectations
protected bool $_mockery_deferMissing
리턴 boolean

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

Flag to indicate we should ignore all expectations temporarily. Used mainly to prevent expectation matching when in the middle of a mock object recording session.
protected bool $_mockery_disableExpectationMatching
리턴 boolean

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

Stores an array of all expectation directors for this mock
protected array $_mockery_expectations
리턴 array

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

Stores an inital number of expectations that can be manipulated while using the getter method.
protected int $_mockery_expectations_count
리턴 integer

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

Ordered groups
protected array $_mockery_groups
리턴 array

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

Flag to indicate whether we can ignore method calls missing from our expectations
protected bool $_mockery_ignoreMissing
리턴 boolean

$_mockery_methods 보호되어 있는 정적으로 프로퍼티

Just a local cache for this mock's target's methods
protected static ReflectionMethod[] $_mockery_methods
리턴 ReflectionMethod[]

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

protected array $_mockery_mockableMethods
리턴 array

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

Stores all stubbed public methods separate from any on-object public properties that may exist.
protected array $_mockery_mockableProperties
리턴 array

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

Given name of the mock
protected string $_mockery_name
리턴 string

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

Instance of a core object on which methods are called in the event it has been set, and an expectation for one of the object's methods does not exist. This implements a simple partial mock proxy system.
protected object $_mockery_partial
리턴 object

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

protected $_mockery_receivedMethodCalls

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

Flag to indicate whether this mock was verified
protected bool $_mockery_verified
리턴 boolean