ComposeManagerIpsTest::testIpsWithprojectOption()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace DockerCompose\Tests\Manager;
4
5
use PHPUnit_Framework_TestCase;
6
use DockerCompose\ComposeFile;
7
use DockerCompose\ComposeFileCollection;
8
9
10 View Code Duplication
class ComposeManagerIpsTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    public function setUp()
13
    {
14
        $this->mockedManager = $this->getMockBuilder('\DockerCompose\Manager\ComposeManager')
15
            ->setMethods(['execute'])
16
            ->getMock();
17
    }
18
19
    /**
20
     * Test simple get ips containers
21
     */
22
    public function testIps()
23
    {
24
        $this->mockedManager
25
            ->method('execute')
26
            ->willReturn(array('output' => 'ok', 'code' => 0));
27
28
        $this->assertEquals($this->mockedManager->ips(), 'ok');
29
    }
30
31
    /**
32
     * Test start success with one compose file
33
     */
34
    public function testIpsWithOneComposeFileSpecified()
35
    {
36
        $this->mockedManager
37
        ->method('execute')
38
        ->willReturn(array('output' => 'ok', 'code' => 0));
39
        $this->assertEquals($this->mockedManager->ips('docker-compose.test.yml'), 'ok');
40
    }
41
42
    /**
43
     * Test ips success with two compose files
44
     */
45
    public function testIpsWithTwoComposeFilesSpecified()
46
    {
47
        $this->mockedManager
48
            ->method('execute')
49
            ->willReturn(array('output' => 'ok', 'code' => 0));
50
        $this->assertEquals($this->mockedManager->ips(['docker-compose.yml', 'docker-compose.test.yml']), 'ok');
51
    }
52
53
    /**
54
     * Test ips with project option
55
     */
56
    public function testIpsWithprojectOption()
57
    {
58
        $composeFiles = new ComposeFileCollection(['docker-compose.test.yml']);
59
        $composeFiles->setProjectName('unittest');
60
61
        $this->mockedManager
62
            ->method('execute')
63
            ->willReturn(array('output' => 'ok', 'code' => 0));
64
65
        $this->assertEquals($this->mockedManager->ips($composeFiles), 'ok');
66
    }
67
}
68