PHP Класс Mockery\Mock

Наследование: implements Mockery\MockInterface
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$_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
public mockery_getCurrentOrder ( ) : integer
Результат integer

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

Gets the count of expectations for this mock
public mockery_getExpectationCount ( ) : integer
Результат integer

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() публичный Метод

public mockery_getMockableProperties ( ) : array
Результат array

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