* @license MIT * * @group Coverage */ class MagicSleepTest extends PHPUnit_Framework_TestCase { /** * @covers \ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\MagicSleep::__construct */ public function testBodyStructure() { $reflection = new ReflectionClass('ProxyManagerTestAsset\\EmptyClass'); $initializer = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator'); $initMethod = $this->getMock('Zend\\Code\\Generator\\MethodGenerator'); $initializer->expects($this->any())->method('getName')->will($this->returnValue('foo')); $initMethod->expects($this->any())->method('getName')->will($this->returnValue('bar')); $magicSleep = new MagicSleep($reflection, $initializer, $initMethod); $this->assertSame('__sleep', $magicSleep->getName()); $this->assertCount(0, $magicSleep->getParameters()); $this->assertSame( "\$this->foo && \$this->bar('__sleep', array());" . "\n\nreturn array_keys((array) \$this);", $magicSleep->getBody() ); } }