Documentation

InstanceMockPass
in package

Table of Contents

INSTANCE_MOCK_CODE  = <<<MOCK protected $_mockery_ignoreVerification = true; public function __construct() { $this->_mockery_ignoreVerification = false; $associatedRealObject = \Mockery::fetchMock(__CLASS__); foreach (get_object_vars($this) as $attr => $val) { if ($attr !== "_mockery_ignoreVerification" && $attr !== "_mockery_expectations") { $this->$attr = $associatedRealObject->$attr; } } $directors = $associatedRealObject->mockery_getExpectations(); foreach ($directors as $method=>$director) { // get the director method needed $existingDirector = $this->mockery_getExpectationsFor($method); if (!$existingDirector) { $existingDirector = new \Mockery\ExpectationDirector($method, $this); $this->mockery_setExpectationsFor($method, $existingDirector); } $expectations = $director->getExpectations(); foreach ($expectations as $expectation) { $clonedExpectation = clone $expectation; $existingDirector->addExpectation($clonedExpectation); } $defaultExpectations = $director->getDefaultExpectations(); foreach (array_reverse($defaultExpectations) as $expectation) { $clonedExpectation = clone $expectation; $existingDirector->addExpectation($clonedExpectation); $existingDirector->makeExpectationDefault($clonedExpectation); } } \Mockery::getContainer()->rememberMock($this); $this->_mockery_constructorCalled(func_get_args()); } MOCK
apply()  : mixed
appendToClass()  : mixed

Constants

INSTANCE_MOCK_CODE

public mixed INSTANCE_MOCK_CODE = <<<MOCK protected $_mockery_ignoreVerification = true; public function __construct() { $this->_mockery_ignoreVerification = false; $associatedRealObject = \Mockery::fetchMock(__CLASS__); foreach (get_object_vars($this) as $attr => $val) { if ($attr !== "_mockery_ignoreVerification" && $attr !== "_mockery_expectations") { $this->$attr = $associatedRealObject->$attr; } } $directors = $associatedRealObject->mockery_getExpectations(); foreach ($directors as $method=>$director) { // get the director method needed $existingDirector = $this->mockery_getExpectationsFor($method); if (!$existingDirector) { $existingDirector = new \Mockery\ExpectationDirector($method, $this); $this->mockery_setExpectationsFor($method, $existingDirector); } $expectations = $director->getExpectations(); foreach ($expectations as $expectation) { $clonedExpectation = clone $expectation; $existingDirector->addExpectation($clonedExpectation); } $defaultExpectations = $director->getDefaultExpectations(); foreach (array_reverse($defaultExpectations) as $expectation) { $clonedExpectation = clone $expectation; $existingDirector->addExpectation($clonedExpectation); $existingDirector->makeExpectationDefault($clonedExpectation); } } \Mockery::getContainer()->rememberMock($this); $this->_mockery_constructorCalled(func_get_args()); } MOCK

Methods

appendToClass()

protected appendToClass(mixed $class, mixed $code) : mixed
Parameters
$class : mixed
$code : mixed
Return values
mixed

Search results