ComposeFileCollectionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateCompseFileCollectionSuccess() 0 7 1
A testCreateCompseFileCollectionFailedNotArray() 0 3 1
A testCreateCompseFileCollectionFailedInvalidTypeOfData() 0 3 1
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
        new ComposeFileCollection('docker-compose.yml');
31
    }
32
33
    /**
34
     * Test create file failed because is not string or ComposeFile
35
     *
36
     * @expectedException Exception
37
     */
38
    public function testCreateCompseFileCollectionFailedInvalidTypeOfData() {
39
        new ComposeFileCollection(['docker-compose.yml', 12]);
40
    }
41
}
42