You are here

protected function ProxyLogicTest::configureInitializerMock in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php \Doctrine\Tests\Common\Proxy\ProxyLogicTest::configureInitializerMock()

Configures the current initializer callback mock with provided matcher params

Parameters

int $expectedCallCount the number of invocations to be expected. If a value< 0 is provided, `any` is used:

array $callParamsMatch an ordered array of parameters to be expected:

callable $callbackClosure a return callback closure:

Return value

\PHPUnit_Framework_MockObject_MockObject|

17 calls to ProxyLogicTest::configureInitializerMock()
ProxyLogicTest::testCallingMethodCausesLazyLoading in vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testCheckingPublicAssociationCausesLazyLoading in vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testCheckingPublicFieldsCausesLazyLoading in vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testFalseWhenCheckingNonExistentProperty in vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testFetchingIdentifiersViaPublicGetterDoesNotCauseLazyLoading in vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php

... See full list

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php, line 671

Class

ProxyLogicTest
Test the generated proxies behavior. These tests make assumptions about the structure of LazyLoadableObject

Namespace

Doctrine\Tests\Common\Proxy

Code

protected function configureInitializerMock($expectedCallCount = 0, array $callParamsMatch = null, \Closure $callbackClosure = null) {
  if (!$expectedCallCount) {
    $invocationCountMatcher = $this
      ->exactly((int) $expectedCallCount);
  }
  else {
    $invocationCountMatcher = $expectedCallCount < 0 ? $this
      ->any() : $this
      ->exactly($expectedCallCount);
  }
  $invocationMocker = $this->initializerCallbackMock
    ->expects($invocationCountMatcher)
    ->method('__invoke');
  if (null !== $callParamsMatch) {
    call_user_func_array(array(
      $invocationMocker,
      'with',
    ), $callParamsMatch);
  }
  if ($callbackClosure) {
    $invocationMocker
      ->will($this
      ->returnCallback($callbackClosure));
  }
}