* @license MIT * * @group Coverage */ class MagicCloneTest extends PHPUnit_Framework_TestCase { /** * @covers \ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\MagicClone::__construct */ public function testBodyStructure() { $reflection = new ReflectionClass('ProxyManagerTestAsset\\EmptyClass'); $initializer = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator'); $valueHolder = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator'); $initializer->expects($this->any())->method('getName')->will($this->returnValue('foo')); $valueHolder->expects($this->any())->method('getName')->will($this->returnValue('bar')); $magicClone = new MagicClone($reflection, $initializer, $valueHolder); $this->assertSame('__clone', $magicClone->getName()); $this->assertCount(0, $magicClone->getParameters()); $this->assertSame( "\$this->foo && \$this->foo->__invoke(\$this->bar, \$this, " . "'__clone', array(), \$this->foo);\n\n\$this->bar = clone \$this->bar;", $magicClone->getBody() ); } }