Completed
Branch feature/add-scrutinizer (27b569)
by Matthias
02:05
created

DependencyGuesserTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGuessExtJson() 0 9 2
A testDoesNotSuggestAnything() 0 5 1
1
<?php
2
3
namespace ComposerRequireCheckerTest\DependencyGuesser;
4
5
6
use ComposerRequireChecker\DependencyGuesser\DependencyGuesser;
7
8
class DependencyGuesserTest extends \PHPUnit_Framework_TestCase
9
{
10
11
    /**
12
     * @var DependencyGuesser
13
     */
14
    private $guesser;
15
16
    public function setUp()
17
    {
18
        $this->guesser = new DependencyGuesser();
19
    }
20
21
    public function testGuessExtJson()
22
    {
23
        if(!extension_loaded('json')) {
24
            $this->markTestSkipped('extension json is not available');
25
        }
26
        $result = $this->guesser->__invoke('json_decode');
27
        $this->assertNotEmpty($result);
28
        $this->assertContains('ext-json', $result);
29
    }
30
31
    public function testDoesNotSuggestAnything()
32
    {
33
        $result = $this->guesser->__invoke('an_hopefully_unique_unknown_symbol');
34
        $this->assertFalse($result->valid());
35
    }
36
37
}
38