You are here

protected function ProxyLogicTest::configureInitializerMock in Plug 7

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 lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testCheckingPublicAssociationCausesLazyLoading in lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testCheckingPublicFieldsCausesLazyLoading in lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testFalseWhenCheckingNonExistentProperty in lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php
ProxyLogicTest::testFetchingIdentifiersViaPublicGetterDoesNotCauseLazyLoading in lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php

... See full list

File

lib/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));
  }
}