Ejemplo n.º 1
0
 /**
  * @return void
  * @covers \pdepend\reflection\api\StaticReflectionMethod
  * @group reflection
  * @group reflection::api
  * @group unittest
  * @expectedException \LogicException
  */
 public function testInitStartLineThrowsLogicExceptionWhenAlreadySet()
 {
     $method = new StaticReflectionMethod('foo', '', 0);
     $method->initStartLine(42);
     $method->initStartLine(42);
 }
 /**
  * @return void
  * @covers \pdepend\reflection\api\StaticReflectionInterface
  * @group reflection
  * @group reflection::api
  * @group unittest
  */
 public function testToStringReturnsExpectedResultForInterfaceWithMethods()
 {
     $modifiers = StaticReflectionMethod::IS_ABSTRACT | StaticReflectionMethod::IS_PUBLIC;
     $method1 = new StaticReflectionMethod('x', '', $modifiers);
     $method1->initStartLine(27);
     $method1->initEndLine(27);
     $method2 = new StaticReflectionMethod('y', '', $modifiers);
     $method2->initStartLine(32);
     $method2->initEndLine(32);
     $interface = new StaticReflectionInterface('Foo', '');
     $interface->initFileName('/bar/Foo.php');
     $interface->initStartLine(23);
     $interface->initEndLine(42);
     $interface->initMethods(array($method1, $method2));
     $actual = $interface->__toString();
     $expected = 'Interface [ <user> interface Foo ] {' . 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 [2] {' . PHP_EOL . '    Method [ <user> abstract public method x ] {' . PHP_EOL . '      @@ /bar/Foo.php 27 - 27' . PHP_EOL . '    }' . PHP_EOL . '    Method [ <user> abstract public method y ] {' . PHP_EOL . '      @@ /bar/Foo.php 32 - 32' . PHP_EOL . '    }' . PHP_EOL . '  }' . PHP_EOL . '}';
     $this->assertEquals($expected, $actual);
 }