1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types = 1); |
4
|
|
|
|
5
|
|
|
namespace spec\hanneskod\readmetester\Name; |
6
|
|
|
|
7
|
|
|
use hanneskod\readmetester\Name\FilesystemNameResolver; |
8
|
|
|
use hanneskod\readmetester\Name\NameResolverInterface; |
9
|
|
|
use hanneskod\readmetester\Name\NameInterface; |
10
|
|
|
use PhpSpec\ObjectBehavior; |
|
|
|
|
11
|
|
|
use Prophecy\Argument; |
|
|
|
|
12
|
|
|
|
13
|
|
|
class FilesystemNameResolverSpec extends ObjectBehavior |
14
|
|
|
{ |
15
|
|
|
function it_is_initializable() |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
$this->shouldHaveType(FilesystemNameResolver::CLASS); |
|
|
|
|
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
function it_is_a_resolver() |
21
|
|
|
{ |
22
|
|
|
$this->shouldHaveType(NameResolverInterface::CLASS); |
|
|
|
|
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
function it_returns_resolved_paths(NameInterface $baseName, NameInterface $toResolve) |
26
|
|
|
{ |
27
|
|
|
$toResolve->getShortName()->willReturn(''); |
28
|
|
|
$toResolve->getNamespaceName()->willReturn(__FILE__); |
29
|
|
|
$this->resolve($baseName, $toResolve)->shouldResolveNamespaceTo(__FILE__); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
function it_returns_expanded_paths(NameInterface $baseName, NameInterface $toResolve) |
33
|
|
|
{ |
34
|
|
|
$toResolve->getShortName()->willReturn(''); |
35
|
|
|
$toResolve->getNamespaceName()->willReturn(__DIR__ . '/../Name/FilesystemNameResolverSpec.php'); |
36
|
|
|
$this->resolve($baseName, $toResolve)->shouldResolveNamespaceTo(__DIR__ . '/FilesystemNameResolverSpec.php'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
function it_prepends_basepath_if_applicable(NameInterface $baseName, NameInterface $toResolve) |
40
|
|
|
{ |
41
|
|
|
$toResolve->getShortName()->willReturn(''); |
42
|
|
|
$toResolve->getNamespaceName()->willReturn('FilesystemNameResolverSpec.php'); |
43
|
|
|
$baseName->getNamespaceName()->willReturn(__DIR__ . '/OtherFile.php'); |
44
|
|
|
$this->resolve($baseName, $toResolve)->shouldResolveNamespaceTo(__DIR__ . '/FilesystemNameResolverSpec.php'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
function it_ignores_if_unable_to_resolve(NameInterface $baseName, NameInterface $toResolve) |
48
|
|
|
{ |
49
|
|
|
$toResolve->getNamespaceName()->willReturn('DOES-NOT-EXIST'); |
50
|
|
|
$baseName->getNamespaceName()->willReturn(__FILE__); |
51
|
|
|
$this->resolve($baseName, $toResolve)->shouldReturn($toResolve); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function getMatchers(): array |
55
|
|
|
{ |
56
|
|
|
return [ |
57
|
|
|
'resolveNamespaceTo' => function (NameInterface $name, string $namespace) { |
58
|
|
|
return $name->getNamespaceName() == $namespace; |
59
|
|
|
}, |
60
|
|
|
]; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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