Passed
Pull Request — master (#102)
by Marco
02:42
created

testWillInstantiateLocator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 15
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RoaveTest\BackwardCompatibility\Factory;
6
7
use PHPUnit\Framework\TestCase;
8
use Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory;
9
use Roave\BackwardCompatibility\LocateSources\LocateSources;
10
use Roave\BetterReflection\Reflector\ClassReflector;
11
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;
12
use function uniqid;
13
14
/**
15
 * @covers \Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory
16
 */
17
final class ComposerInstallationReflectorFactoryTest extends TestCase
18
{
19
    /**
20
     * Note: this test is quite pointless, it is just in place to verify that there aren't any
21
     *       silly runtime-related regressions.
22
     */
23
    public function testWillInstantiateLocator() : void
24
    {
25
        $path          = uniqid('path', true);
26
        $locateSources = $this->createMock(LocateSources::class);
27
28
        $locateSources
29
            ->expects(self::atLeastOnce())
30
            ->method('__invoke')
31
            ->with($path)
32
            ->willReturn($this->createMock(SourceLocator::class));
33
34
        self::assertInstanceOf(
35
            ClassReflector::class,
36
            (new ComposerInstallationReflectorFactory($locateSources))
37
                ->__invoke($path, $this->createMock(SourceLocator::class))
38
        );
39
    }
40
}
41