You are here

public function AbstractProxyFactoryTest::testGenerateProxyClasses in Plug 7

File

lib/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php, line 10

Class

AbstractProxyFactoryTest

Namespace

Doctrine\Tests\Common\Proxy

Code

public function testGenerateProxyClasses() {
  $metadata = $this
    ->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata');
  $proxyGenerator = $this
    ->getMock('Doctrine\\Common\\Proxy\\ProxyGenerator', array(), array(), '', false);
  $proxyGenerator
    ->expects($this
    ->once())
    ->method('getProxyFileName');
  $proxyGenerator
    ->expects($this
    ->once())
    ->method('generateProxyClass');
  $metadataFactory = $this
    ->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadataFactory');
  $proxyFactory = $this
    ->getMockForAbstractClass('Doctrine\\Common\\Proxy\\AbstractProxyFactory', array(
    $proxyGenerator,
    $metadataFactory,
    true,
  ));
  $proxyFactory
    ->expects($this
    ->any())
    ->method('skipClass')
    ->will($this
    ->returnValue(false));
  $generated = $proxyFactory
    ->generateProxyClasses(array(
    $metadata,
  ), sys_get_temp_dir());
  $this
    ->assertEquals(1, $generated, 'One proxy was generated');
}