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

testThrowComposeFileNotFoundException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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
use DockerCompose\Manager\ComposeManager;
9
10
11
class ComposeManagerIntegrationTest extends PHPUnit_Framework_TestCase
12
{
13
    public function setUp()
14
    {
15
        $this->manager = new ComposeManager();
16
    }
17
18
    /**
19
     * Test simple start without error
20
     *
21
     *  @expectedException \DockerCompose\Exception\ComposeFileNotFoundException
22
     */
23
    public function testThrowComposeFileNotFoundException()
24
    {
25
        $this->assertEquals($this->manager->start(), '');
26
    }
27
28
    /**
29
     * Test simple start, ps, stop and rm without error
30
     *
31
     */
32
    public function testSuccess()
33
    {
34
        $this->assertEquals($this->manager->start('/var/www/docker-compose-test.yml'), '');
35
        $result = $this->manager->ps('/var/www/docker-compose-test.yml');
36
        $this->assertEquals(strpos($result, 'www_test_1'), 118);
37
        $this->assertEquals($this->manager->stop('/var/www/docker-compose-test.yml'), '');
38
        $this->assertEquals($this->manager->remove('/var/www/docker-compose-test.yml'), 'Going to remove www_test_1');
39
    }
40
41
    /**
42
     * Test simple run without error
43
     *
44
     */
45 View Code Duplication
    public function testRunSuccess()
0 ignored issues
show
Duplication introduced by
This method 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...
46
    {
47
        $composeFiles = new ComposeFileCollection(['/var/www/docker-compose-test.yml']);
48
        $composeFiles->setProjectName('unittest');
49
50
        $this->assertEquals($this->manager->run('test', 'echo test', $composeFiles), "test");
51
    }
52
53
    /**
54
     * Test run
55
     * @expectedException \DockerCompose\Exception\NoSuchServiceException
56
     */
57 View Code Duplication
    public function testrunThrowNoSuchServiceException()
0 ignored issues
show
Duplication introduced by
This method 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...
58
    {
59
        $composeFiles = new ComposeFileCollection(['/var/www/docker-compose-test.yml']);
60
        $composeFiles->setProjectName('unittest');
61
62
        $this->manager->run('failedservice', 'echo test', $composeFiles);
63
    }
64
65
}
66