Failed Conditions
Pull Request — master (#91)
by Matthias
03:24
created

GuessFromComposerAutoloaderTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest\DependencyGuesser;
4
5
6
use ComposerRequireChecker\DependencyGuesser\DependencyGuesser;
7
use ComposerRequireChecker\DependencyGuesser\GuesserInterface;
8
use ComposerRequireChecker\DependencyGuesser\GuessFromComposerAutoloader;
9
use PhpParser\ParserFactory;
10
use PHPUnit\Framework\TestCase;
11
12
class GuessFromComposerAutoloaderTest extends TestCase
13
{
14
15
    /**
16
     * @var GuesserInterface
17
     */
18
    private $guesser;
19
20
    public function setUp()
21
    {
22
        $dir = dirname(__DIR__, 3);
23
        $this->guesser = new DependencyGuesser(new GuessFromComposerAutoloader($dir . '/composer.json'));
0 ignored issues
show
Documentation Bug introduced by
It seems like new ComposerRequireCheck...ir . '/composer.json')) of type ComposerRequireChecker\D...esser\DependencyGuesser is incompatible with the declared type ComposerRequireChecker\D...uesser\GuesserInterface of property $guesser.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
24
    }
25
26
    public function testClassWillBeFound()
27
    {
28
        $quessedDependencies = $this->guesser->__invoke(ParserFactory::class);
29
        $guessedDependencies = iterator_to_array($quessedDependencies);
30
31
        $this->assertCount(1, $guessedDependencies);
32
        $this->assertContains('nikic/php-parser', $guessedDependencies);
33
    }
34
}
35