You are here

public function ProxyClassGeneratorTest::testClassWithCallableTypeHintOnProxiedMethod in Zircon Profile 8

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

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php, line 147

Class

ProxyClassGeneratorTest
Test the proxy generator. Its work is generating on-the-fly subclasses of a given model, which implement the Proxy pattern.

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testClassWithCallableTypeHintOnProxiedMethod() {
  if (PHP_VERSION_ID < 50400) {
    $this
      ->markTestSkipped('`callable` is only supported in PHP >=5.4.0');
  }
  if (!class_exists('Doctrine\\Tests\\Common\\ProxyProxy\\__CG__\\CallableTypeHintClass', false)) {
    $className = 'Doctrine\\Tests\\Common\\Proxy\\CallableTypeHintClass';
    $metadata = $this
      ->createClassMetadata($className, array(
      'id',
    ));
    $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true);
    $this
      ->generateAndRequire($proxyGenerator, $metadata);
  }
  $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyCallableTypeHintClass.php');
  $this
    ->assertEquals(1, substr_count($classCode, 'call(callable $foo)'));
}