1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/** |
3
|
|
|
* This file is part of the daikon-cqrs/metadata project. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace Daikon\Tests\Metadata; |
10
|
|
|
|
11
|
|
|
use Daikon\Metadata\Metadata; |
12
|
|
|
use Daikon\Metadata\MetadataEnricherInterface; |
13
|
|
|
use Daikon\Metadata\MetadataEnricherList; |
|
|
|
|
14
|
|
|
use PHPUnit\Framework\TestCase; |
15
|
|
|
|
16
|
|
|
final class MetadataEnricherListTest extends TestCase |
17
|
|
|
{ |
18
|
1 |
|
public function testConstructWithSelf(): void |
19
|
|
|
{ |
20
|
|
|
/** @var MetadataEnricherInterface $mockEnricher */ |
21
|
1 |
|
$mockEnricher = $this->createMock(MetadataEnricherInterface::class); |
22
|
1 |
|
$enricherList = new MetadataEnricherList([$mockEnricher]); |
23
|
1 |
|
$newList = new MetadataEnricherList($enricherList); |
24
|
1 |
|
$this->assertCount(1, $newList); |
25
|
1 |
|
$this->assertFalse($enricherList === $newList); |
26
|
1 |
|
} |
27
|
|
|
|
28
|
1 |
|
public function testWith(): void |
29
|
|
|
{ |
30
|
1 |
|
$emptyList = new MetadataEnricherList; |
31
|
|
|
/** @var MetadataEnricherInterface $mockEnricher */ |
32
|
1 |
|
$mockEnricher = $this->createMock(MetadataEnricherInterface::class); |
33
|
1 |
|
$enricherList = $emptyList->push($mockEnricher); |
34
|
1 |
|
$this->assertCount(1, $enricherList); |
35
|
1 |
|
$this->assertTrue($emptyList->isEmpty()); |
36
|
1 |
|
} |
37
|
|
|
|
38
|
1 |
|
public function testPrependEnricher(): void |
39
|
|
|
{ |
40
|
1 |
|
$mockEnricher = $this->createMock(MetadataEnricherInterface::class); |
41
|
1 |
|
$mockEnricher->expects($this->once())->method('enrich')->willReturnArgument(0); |
42
|
1 |
|
$enricherList = new MetadataEnricherList([$mockEnricher]); |
43
|
1 |
|
$newList = $enricherList->prependEnricher('key', 'value'); |
44
|
1 |
|
$this->assertCount(2, $newList); |
45
|
1 |
|
$this->assertNotSame($enricherList, $newList); |
46
|
1 |
|
$this->assertFalse($enricherList === $newList); |
47
|
1 |
|
$metadata = Metadata::fromNative(['abc' => 'xyz']); |
48
|
|
|
/** @var MetadataEnricherInterface $enricher */ |
49
|
1 |
|
foreach ($newList as $enricher) { |
50
|
1 |
|
$metadata = $enricher->enrich($metadata); |
51
|
|
|
} |
52
|
1 |
|
$this->assertEquals(['abc' => 'xyz', 'key' => 'value'], $metadata->toNative()); |
53
|
1 |
|
} |
54
|
|
|
} |
55
|
|
|
|
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