Completed
Push — master ( d02514...5c186b )
by Martin
02:41
created

PackageTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstruct() 0 4 1
A testIsInstalled() 0 6 1
1
<?php
2
namespace PackageInfoTest\Unit;
3
4
use PHPUnit_Framework_TestCase;
5
use PackageInfo\Package;
6
7
/**
8
 * @covers \PackageInfo\Package
9
 */
10
class PackageTest extends PHPUnit_Framework_TestCase
11
{
12
13
    /**
14
     * @expectedException \PackageInfo\Exception\PackageNotInstalledException
15
     * @expectedExceptionMessage Package "vendor/something" is not installed through composer, or you installed it with the flag --no-scripts
16
     */
17
    public function testConstruct()
18
    {
19
        $package = new Package('vendor/something');
0 ignored issues
show
Unused Code introduced by
$package is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
20
    }
21
    
22
    public function testIsInstalled()
23
    {
24
        $bool = Package::isInstalled('vendor/something');
25
        
26
        $this->assertFalse($bool);
27
    }
28
}
29