@@ 10-67 (lines=58) @@ | ||
7 | use DockerCompose\ComposeFileCollection; |
|
8 | ||
9 | ||
10 | class ComposeManagerIpsTest extends PHPUnit_Framework_TestCase |
|
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 |
@@ 10-58 (lines=49) @@ | ||
7 | use DockerCompose\ComposeFileCollection; |
|
8 | ||
9 | ||
10 | class ComposeManagerPsTest extends PHPUnit_Framework_TestCase |
|
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 ps without error |
|
21 | */ |
|
22 | public function testPs() |
|
23 | { |
|
24 | $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0)); |
|
25 | $this->assertEquals($this->mockedManager->ps(), 'ok'); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Test ps success with one compose file |
|
30 | */ |
|
31 | public function testPsWithOneComposeFileSpecified() |
|
32 | { |
|
33 | $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0)); |
|
34 | $this->assertEquals($this->mockedManager->ps('docker-compose.test.yml'), 'ok'); |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * Test ps success with two compose files |
|
39 | */ |
|
40 | public function testPsWithTwoComposeFilesSpecified() |
|
41 | { |
|
42 | $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0)); |
|
43 | $this->assertEquals($this->mockedManager->ps(['docker-compose.yml', 'docker-compose.test.yml']), 'ok'); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * Test ps with project option |
|
48 | */ |
|
49 | public function testPsWithprojectOption() |
|
50 | { |
|
51 | $composeFiles = new ComposeFileCollection(['docker-compose.test.yml']); |
|
52 | $composeFiles->setProjectName('unittest'); |
|
53 | ||
54 | $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0)); |
|
55 | ||
56 | $this->assertEquals($this->mockedManager->ps($composeFiles), 'ok'); |
|
57 | } |
|
58 | } |
|
59 |