/** * @return void * @covers \pdepend\reflection\api\StaticReflectionClass * @group reflection * @group reflection::api * @group unittest */ public function testToStringReturnsExpectedResultForClassWithImplementedInterfaces() { $class = new StaticReflectionClass('Foo', '', 0); $class->initInterfaces(array(new StaticReflectionInterface('Bar', '', 0))); $class->initFileName('/bar/Foo.php'); $class->initStartLine(23); $class->initEndLine(42); $actual = $class->__toString(); $expected = 'Class [ <user> class Foo implements Bar ] {' . PHP_EOL . ' @@ /bar/Foo.php 23-42' . PHP_EOL . PHP_EOL . ' - Constants [0] {' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' - Properties [0] {' . PHP_EOL . ' }' . PHP_EOL . PHP_EOL . ' - Methods [0] {' . PHP_EOL . ' }' . PHP_EOL . '}'; $this->assertEquals($expected, $actual); }
/** * testGetPrototypeParentClassHidesParentInterface * * @return void * @covers \pdepend\reflection\api\StaticReflectionMethod * @group reflection * @group reflection::api * @group unittest */ public function testGetPrototypeParentClassHidesParentInterface() { $method = new StaticReflectionMethod('foo', '', 0); $interface = new StaticReflectionInterface('IFoo', ''); $interface->initMethods(array(new StaticReflectionMethod('foo', '', 0))); $declaringClass = new StaticReflectionClass('Bar', '', 0); $declaringClass->initMethods(array($method)); $declaringClass->initInterfaces(array($interface)); $this->assertSame($interface, $method->getPrototype()->getDeclaringClass()); }