* @license MIT * * @covers \ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\InterceptedMethod * @group Coverage */ class InterceptedMethodTest extends PHPUnit_Framework_TestCase { public function testBodyStructure() { $prefixInterceptors = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator'); $suffixInterceptors = $this->getMock('Zend\\Code\\Generator\\PropertyGenerator'); $prefixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('pre')); $suffixInterceptors->expects($this->any())->method('getName')->will($this->returnValue('post')); $method = InterceptedMethod::generateMethod( new MethodReflection('ProxyManagerTestAsset\\BaseClass', 'publicByReferenceParameterMethod'), $prefixInterceptors, $suffixInterceptors ); $this->assertInstanceOf('ProxyManager\\Generator\\MethodGenerator', $method); $this->assertSame('publicByReferenceParameterMethod', $method->getName()); $this->assertCount(2, $method->getParameters()); $this->assertGreaterThan( 0, strpos( $method->getBody(), '$returnValue = parent::publicByReferenceParameterMethod($param, $byRefParam);' ) ); } }