Failed Conditions
Pull Request — master (#90)
by
unknown
02:26
created

RuntimeReflectionServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 2
b 0
f 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A testGetTypedDefaultReflectionProperty() 0 5 1
A testGetTypedNoDefaultReflectionProperty() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests_PHP74\Persistence\Mapping;
6
7
use Doctrine\Common\Reflection\TypedNoDefaultReflectionProperty;
8
use Doctrine\Persistence\Mapping\RuntimeReflectionService;
9
use PHPUnit\Framework\TestCase;
10
use ReflectionProperty;
11
12
/**
13
 * @group DCOM-93
14
 */
15
class RuntimeReflectionServiceTest extends TestCase
16
{
17
    /** @var RuntimeReflectionService */
18
    private $reflectionService;
19
20
    private string $typedNoDefaultProperty;
0 ignored issues
show
introduced by
The private property $typedNoDefaultProperty is not used, and could be removed.
Loading history...
21
    private string $typedDefaultProperty = '';
0 ignored issues
show
introduced by
The private property $typedDefaultProperty is not used, and could be removed.
Loading history...
22
23
    protected function setUp() : void
24
    {
25
        $this->reflectionService = new RuntimeReflectionService();
26
    }
27
28
    public function testGetTypedNoDefaultReflectionProperty() : void
29
    {
30
        $reflProp = $this->reflectionService->getAccessibleProperty(self::class, 'typedNoDefaultProperty');
31
        self::assertInstanceOf(TypedNoDefaultReflectionProperty::class, $reflProp);
32
    }
33
34
    public function testGetTypedDefaultReflectionProperty() : void
35
    {
36
        $reflProp = $this->reflectionService->getAccessibleProperty(self::class, 'typedDefaultProperty');
37
        self::assertInstanceOf(ReflectionProperty::class, $reflProp);
38
        self::assertNotInstanceOf(TypedNoDefaultReflectionProperty::class, $reflProp);
39
    }
40
}
41