1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace spec\hanneskod\readmetester\Example; |
6
|
|
|
|
7
|
|
|
use hanneskod\readmetester\Example\ExampleRegistry; |
8
|
|
|
use hanneskod\readmetester\Example\ExampleInterface; |
9
|
|
|
use hanneskod\readmetester\Example\RegistryInterface; |
10
|
|
|
use hanneskod\readmetester\Name\NameInterface; |
11
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
12
|
|
|
use Prophecy\Argument; |
|
|
|
|
13
|
|
|
|
14
|
|
|
class ExampleRegistrySpec extends ObjectBehavior |
15
|
|
|
{ |
16
|
|
|
function it_is_initializable() |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
$this->shouldHaveType(ExampleRegistry::CLASS); |
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
function it_is_a_registry() |
22
|
|
|
{ |
23
|
|
|
$this->shouldHaveType(RegistryInterface::CLASS); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
function it_can_have_example(ExampleInterface $example, NameInterface $name) |
27
|
|
|
{ |
28
|
|
|
$name->getCompleteName()->willReturn('foobar'); |
29
|
|
|
$name->isUnnamed()->willReturn(false); |
30
|
|
|
$example->getName()->willReturn($name); |
|
|
|
|
31
|
|
|
$this->setExample($example); |
32
|
|
|
$this->hasExample($name)->shouldReturn(true); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
function it_does_not_have_non_loaded_examples(NameInterface $name) |
36
|
|
|
{ |
37
|
|
|
$name->getCompleteName()->willReturn('foobar'); |
38
|
|
|
$name->isUnnamed()->willReturn(false); |
39
|
|
|
$this->hasExample($name)->shouldReturn(false); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
function it_does_not_have_unnamed_examples(ExampleInterface $example, NameInterface $name) |
43
|
|
|
{ |
44
|
|
|
$name->getCompleteName()->willReturn('foobar'); |
45
|
|
|
$name->isUnnamed()->willReturn(true); |
46
|
|
|
$example->getName()->willReturn($name); |
47
|
|
|
$this->setExample($example); |
48
|
|
|
$this->hasExample($name)->shouldReturn(false); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
function it_throws_on_non_loaded_example(NameInterface $name) |
52
|
|
|
{ |
53
|
|
|
$name->getCompleteName()->willReturn('foobar'); |
54
|
|
|
$this->shouldThrow(\RuntimeException::CLASS)->during('getExample', [$name]); |
|
|
|
|
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
function it_can_get_example(ExampleInterface $example, NameInterface $name) |
58
|
|
|
{ |
59
|
|
|
$name->getCompleteName()->willReturn('foobar'); |
60
|
|
|
$name->isUnnamed()->willReturn(false); |
61
|
|
|
$example->getName()->willReturn($name); |
62
|
|
|
$this->setExample($example); |
63
|
|
|
$this->getExample($name)->shouldReturn($example); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
function it_can_get_loaded_examples( |
67
|
|
|
ExampleInterface $unnamedEx, |
68
|
|
|
ExampleInterface $namedEx, |
69
|
|
|
NameInterface $unnamed, |
70
|
|
|
NameInterface $named |
71
|
|
|
) { |
72
|
|
|
$unnamed->getCompleteName()->willReturn('foo'); |
73
|
|
|
$unnamed->isUnnamed()->willReturn(true); |
74
|
|
|
$named->getCompleteName()->willReturn('bar'); |
75
|
|
|
$named->isUnnamed()->willReturn(false); |
76
|
|
|
|
77
|
|
|
$unnamedEx->getName()->willReturn($unnamed); |
78
|
|
|
$namedEx->getName()->willReturn($named); |
79
|
|
|
|
80
|
|
|
$this->setExample($unnamedEx); |
81
|
|
|
$this->setExample($namedEx); |
82
|
|
|
|
83
|
|
|
$this->getExamples()->shouldIterateAs([$unnamedEx, $namedEx]); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
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