Ejemplo n.º 1
0
 /**
  * @return void
  * @covers \pdepend\reflection\api\StaticReflectionMethod
  * @group reflection
  * @group reflection::api
  * @group unittest
  */
 public function testToStringReturnsExpectedResultForMethodWithParameters()
 {
     $class = new StaticReflectionClass('Foo', '', 0);
     $class->initFileName('/bar/Foo.php');
     $method = new StaticReflectionMethod('foo', '', StaticReflectionMethod::IS_PUBLIC);
     $method->initDeclaringClass($class);
     $method->initStartLine(23);
     $method->initEndLine(42);
     $method->initParameters(array(new StaticReflectionParameter('x', 0), new StaticReflectionParameter('y', 1)));
     $actual = $method->__toString();
     $expected = 'Method [ <user> public method foo ] {' . PHP_EOL . '  @@ /bar/Foo.php 23 - 42' . PHP_EOL . PHP_EOL . '  - Parameters [2] {' . PHP_EOL . '    Parameter #0 [ <required> $x ]' . PHP_EOL . '    Parameter #1 [ <required> $y ]' . PHP_EOL . '  }' . PHP_EOL . '}';
     $this->assertEquals($expected, $actual);
 }