Completed
Pull Request — master (#120)
by Marco
04:14
created

LocateSourcesViaComposerJsonTest::locatedSourcesExamples()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 27
nc 1
nop 0
dl 0
loc 36
rs 9.488
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RoaveTest\BackwardCompatibility\LocateSources;
6
7
use baz\LocatedClass;
0 ignored issues
show
Bug introduced by
The type baz\LocatedClass was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\TestCase;
9
use Roave\BackwardCompatibility\LocateSources\LocateSourcesViaComposerJson;
10
use Roave\BetterReflection\BetterReflection;
11
use Roave\BetterReflection\Reflector\ClassReflector;
12
13
/**
14
 * @covers \Roave\BackwardCompatibility\LocateSources\LocateSourcesViaComposerJson
15
 */
16
final class LocateSourcesViaComposerJsonTest extends TestCase
17
{
18
    /** @var LocateSourcesViaComposerJson */
19
    private $locateSources;
20
21
    protected function setUp() : void
22
    {
23
        parent::setUp();
24
25
        $this->locateSources = new LocateSourcesViaComposerJson((new BetterReflection())->astLocator());
26
    }
27
28
    public function testCanLocateClassInMappendAutoloadDefinitions() : void
29
    {
30
        $reflector = new ClassReflector(
31
            $this->locateSources
32
                ->__invoke(__DIR__ . '/../../asset/located-sources/composer-definition-with-everything')
33
        );
34
35
        self::assertSame(
36
            LocatedClass::class,
37
            $reflector
38
                ->reflect(LocatedClass::class)
39
                ->getName()
40
        );
41
    }
42
}
43