1 | <?php |
||
2 | declare(strict_types = 1); |
||
3 | |||
4 | namespace Tests\Innmind\Reflection; |
||
5 | |||
6 | use Innmind\Reflection\{ |
||
7 | ReflectionClass, |
||
0 ignored issues
–
show
|
|||
8 | InjectionStrategy, |
||
9 | InjectionStrategy\InjectionStrategies, |
||
10 | InjectionStrategy\NamedMethodStrategy, |
||
11 | InjectionStrategy\ReflectionStrategy, |
||
12 | InjectionStrategy\SetterStrategy, |
||
13 | Instanciator\ReflectionInstanciator, |
||
14 | Instanciator, |
||
15 | }; |
||
16 | use Fixtures\Innmind\Reflection\{ |
||
17 | NoConstructor, |
||
18 | WithConstructor, |
||
19 | }; |
||
20 | use Innmind\Immutable\Set; |
||
21 | use function Innmind\Immutable\unwrap; |
||
22 | use PHPUnit\Framework\TestCase; |
||
23 | |||
24 | class ReflectionClassTest extends TestCase |
||
25 | { |
||
26 | public function testBuildWithoutProperties() |
||
27 | { |
||
28 | $r = ReflectionClass::of(NoConstructor::class); |
||
29 | |||
30 | $o = $r->build(); |
||
31 | |||
32 | $this->assertInstanceOf(NoConstructor::class, $o); |
||
33 | $this->assertSame(null, $o->a()); |
||
34 | } |
||
35 | |||
36 | public function testBuild() |
||
37 | { |
||
38 | $o = ReflectionClass::of(NoConstructor::class) |
||
39 | ->withProperty('a', 42) |
||
40 | ->build(); |
||
41 | |||
42 | $this->assertInstanceOf(NoConstructor::class, $o); |
||
43 | $this->assertSame(42, $o->a()); |
||
44 | |||
45 | $o = ReflectionClass::of(WithConstructor::class) |
||
46 | ->withProperties( |
||
47 | [ |
||
48 | 'a' => 24, |
||
49 | 'b' => 66, |
||
50 | ] |
||
51 | ) |
||
52 | ->build(); |
||
53 | |||
54 | $this->assertInstanceOf(WithConstructor::class, $o); |
||
55 | $this->assertSame(24, $o->a()); |
||
56 | $this->assertSame(66, $o->b()); |
||
57 | } |
||
58 | |||
59 | public function testProperties() |
||
60 | { |
||
61 | $properties = ReflectionClass::of(WithConstructor::class)->properties(); |
||
62 | |||
63 | $this->assertInstanceOf(Set::class, $properties); |
||
64 | $this->assertSame('string', (string) $properties->type()); |
||
65 | $this->assertSame(['a', 'b'], unwrap($properties)); |
||
66 | } |
||
67 | } |
||
68 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths