Completed
Push — master ( b60ce0...53cbf4 )
by Matthias
02:13
created

DependencyGuesserTest::testGuessExtJson()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest\DependencyGuesser;
4
5
6
use ComposerRequireChecker\DependencyGuesser\DependencyGuesser;
7
use PHPUnit\Framework\TestCase;
8
9
class DependencyGuesserTest extends TestCase
10
{
11
12
    /**
13
     * @var DependencyGuesser
14
     */
15
    private $guesser;
16
17
    public function setUp()
18
    {
19
        $this->guesser = new DependencyGuesser();
20
    }
21
22
    public function testGuessExtJson()
23
    {
24
        if(!extension_loaded('json')) {
25
            $this->markTestSkipped('extension json is not available');
26
        }
27
        $result = $this->guesser->__invoke('json_decode');
28
        $this->assertNotEmpty($result);
29
        $this->assertContains('ext-json', $result);
30
    }
31
32
    public function testDoesNotSuggestAnything()
33
    {
34
        $result = $this->guesser->__invoke('an_hopefully_unique_unknown_symbol');
35
        $this->assertFalse($result->valid());
36
    }
37
38
}
39