Completed
Pull Request — master (#14)
by ophelie
02:29
created

testBuildWithTwoComposeFilesSpecified()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
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
class ComposeManagerBuildTest extends PHPUnit_Framework_TestCase
10
{
11
    public function setUp()
12
    {
13
        $this->mockedManager = $this->getMockBuilder('\DockerCompose\Manager\ComposeManager')
14
            ->setMethods(['execute'])
15
            ->getMock();
16
    }
17
18
    /**
19
     * Test simple build without error
20
     */
21
    public function testBuild()
22
    {
23
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
24
        $this->assertEquals($this->mockedManager->build(), 'ok');
25
    }
26
27
    /**
28
     * Test build success with one compose file
29
     */
30
    public function testBuildWithOneComposeFileSpecified()
31
    {
32
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
33
        $this->assertEquals($this->mockedManager->build('docker-compose.test.yml'), 'ok');
34
    }
35
36
    /**
37
     * Test build success with two compose files
38
     */
39
    public function testBuildWithTwoComposeFilesSpecified()
40
    {
41
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
42
        $this->assertEquals($this->mockedManager->build(['docker-compose.yml', 'docker-compose.test.yml']), 'ok');
43
    }
44
45
    /**
46
     * Test simple build without pull
47
     */
48
    public function testBuildWithoutPull()
49
    {
50
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
51
        $this->assertEquals($this->mockedManager->build([], false), 'ok');
52
    }
53
54
    /**
55
     * Test simple build with --force-rm
56
     */
57
    public function testBuildWithForceRm()
58
    {
59
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
60
        $this->assertEquals($this->mockedManager->build([], false, true), 'ok');
61
    }
62
63
    /**
64
     * Test simple build with --no-cache
65
     */
66
    public function testBuildWithNoCache()
67
    {
68
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
69
        $this->assertEquals($this->mockedManager->build([], false, false, false), 'ok');
70
    }
71
72
    /**
73
     * Test simple build with --pull --force-rm --no-cache
74
     */
75
    public function testBuildWithPullAndForceRmAndNoCache()
76
    {
77
        $this->mockedManager->method('execute')->willReturn(array('output' => 'ok', 'code' => 0));
78
        $this->assertEquals($this->mockedManager->build([], true, true, false), 'ok');
79
80
    }
81
}
82