-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathStaticReflectionServiceTest.php
57 lines (47 loc) · 1.71 KB
/
StaticReflectionServiceTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Doctrine\Tests\Common\Persistence\Mapping;
use Doctrine\Common\Persistence\Mapping\StaticReflectionService;
use PHPUnit\Framework\TestCase;
use stdClass;
use function count;
/**
* @group DCOM-93
*/
class StaticReflectionServiceTest extends TestCase
{
/** @var StaticReflectionService */
private $reflectionService;
public function setUp()
{
$this->reflectionService = new StaticReflectionService();
}
public function testShortname()
{
self::assertSame('StaticReflectionServiceTest', $this->reflectionService->getClassShortName(self::class));
}
public function testClassNamespaceName()
{
self::assertSame('', $this->reflectionService->getClassNamespace(stdClass::class));
self::assertSame(__NAMESPACE__, $this->reflectionService->getClassNamespace(self::class));
}
public function testGetParentClasses()
{
$classes = $this->reflectionService->getParentClasses(self::class);
self::assertTrue(count($classes) === 0, 'The test class ' . self::class . ' should have no parents according to static reflection.');
}
public function testGetReflectionClass()
{
$class = $this->reflectionService->getClass(self::class);
self::assertNull($class);
}
public function testGetMethods()
{
self::assertTrue($this->reflectionService->hasPublicMethod(self::class, 'testGetMethods'));
self::assertTrue($this->reflectionService->hasPublicMethod(self::class, 'testGetMethods2'));
}
public function testGetAccessibleProperty()
{
$reflProp = $this->reflectionService->getAccessibleProperty(self::class, 'reflectionService');
self::assertNull($reflProp);
}
}