| Total Complexity | 8 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class RuntimeReflectionServiceTest extends \PHPUnit\Framework\TestCase |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var RuntimeReflectionService |
||
| 15 | */ |
||
| 16 | private $reflectionService; |
||
| 17 | |||
| 18 | public $unusedPublicProperty; |
||
| 19 | |||
| 20 | public function setUp() |
||
| 21 | { |
||
| 22 | $this->reflectionService = new RuntimeReflectionService(); |
||
| 23 | } |
||
| 24 | |||
| 25 | public function testShortname() |
||
| 26 | { |
||
| 27 | self::assertEquals("RuntimeReflectionServiceTest", $this->reflectionService->getClassShortName(__CLASS__)); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function testClassNamespaceName() |
||
| 31 | { |
||
| 32 | self::assertEquals('Doctrine\Tests\Common\Persistence\Mapping', $this->reflectionService->getClassNamespace(__CLASS__)); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function testGetParentClasses() |
||
| 36 | { |
||
| 37 | $classes = $this->reflectionService->getParentClasses(__CLASS__); |
||
| 38 | self::assertTrue(count($classes) >= 1, "The test class " . __CLASS__ . " should have at least one parent."); |
||
| 39 | } |
||
| 40 | |||
| 41 | public function testGetParentClassesForAbsentClass() |
||
| 42 | { |
||
| 43 | $this->expectException(MappingException::class); |
||
| 44 | $this->reflectionService->getParentClasses(__NAMESPACE__ . '\AbsentClass'); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function testGetReflectionClass() |
||
| 48 | { |
||
| 49 | $class = $this->reflectionService->getClass(__CLASS__); |
||
| 50 | self::assertInstanceOf("ReflectionClass", $class); |
||
| 51 | } |
||
| 52 | |||
| 53 | public function testGetMethods() |
||
| 54 | { |
||
| 55 | self::assertTrue($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods")); |
||
| 56 | self::assertFalse($this->reflectionService->hasPublicMethod(__CLASS__, "testGetMethods2")); |
||
| 57 | } |
||
| 58 | |||
| 59 | public function testGetAccessibleProperty() |
||
| 67 | } |
||
| 68 | } |
||
| 69 |