Completed
Push — master ( 1c72b8...2bd393 )
by ophelie
03:53
created

testCreateCompseFileCollectionSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4286
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace DockerCompose\Tests;
4
5
use PHPUnit_Framework_TestCase;
6
use DockerCompose\ComposeFile;
7
use DockerCompose\ComposeFileCollection;
8
9
10
class ComposeFileCollectionTest extends PHPUnit_Framework_TestCase
11
{
12
13
    /**
14
     * Test create file success from array
15
     */
16
    public function testCreateCompseFileCollectionSuccess() {
17
        $file = new ComposeFile('docker-compose.yml');
18
        $composeFiles = new ComposeFileCollection([$file, 'docker-compose.test.yml']);
19
20
        $this->assertEquals('docker-compose.yml', $composeFiles->getAll()[0]->getFileName());
21
        $this->assertEquals('docker-compose.test.yml', $composeFiles->getAll()[1]->getFileName());
22
    }
23
24
    /**
25
     * Test create file failed because is not an array
26
     *
27
     * @expectedException Exception
28
     */
29
    public function testCreateCompseFileCollectionFailedNotArray() {
30
        $file = new ComposeFileCollection('docker-compose.yml');
0 ignored issues
show
Unused Code introduced by
$file 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...
31
    }
32
33
    /**
34
     * Test create file failed because is not string or ComposeFile
35
     *
36
     * @expectedException Exception
37
     */
38
    public function testCreateCompseFileCollectionFailedInvalidTypeOfData() {
39
        $file = new ComposeFileCollection(['docker-compose.yml', 12]);
0 ignored issues
show
Unused Code introduced by
$file 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...
40
    }
41
}
42