* @license MIT * * @group Coverage */ class MagicSleepTest extends PHPUnit_Framework_TestCase { /** * @covers \ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\MagicSleep::__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')); $magicSleep = new MagicSleep($reflection, $initializer, $valueHolder); $this->assertSame('__sleep', $magicSleep->getName()); $this->assertCount(0, $magicSleep->getParameters()); $this->assertSame( "\$this->foo && \$this->foo->__invoke(\$this->bar, \$this, '__sleep', array(), \$this->foo);" . "\n\nreturn array('bar');", $magicSleep->getBody() ); } }