Completed
Push — 1.x ( ee8545...084efb )
by Joel
02:48
created

BuilderHelperTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Docker\Tests\Helper;
4
5
use Docker\Context\ContextBuilder;
6
use Docker\Helper\BuilderHelper;
7
use Docker\Stream\BuildFrame;
8
use Docker\Tests\TestCase;
9
use Http\Message\StreamFactory\GuzzleStreamFactory;
10
11
class BuilderHelperTest extends TestCase
12
{
13
    /** @var BuilderHelper */
14
    private $buildHelper;
15
16
    public function setUp()
17
    {
18
        $this->buildHelper = new BuilderHelper($this->getDocker()->getImageManager(), new GuzzleStreamFactory());
19
    }
20
21
    public function testBuild()
22
    {
23
        $contextBuilder = new ContextBuilder();
24
        $contextBuilder->from('ubuntu:precise');
25
        $contextBuilder->add('/test', 'test file content');
26
27
        $buildStream = $this->buildHelper->build($contextBuilder->getContext(), 'test-image');
28
        $lastMessage = "";
29
30
        $buildStream->onFrame(function (BuildFrame $frame) use (&$lastMessage) {
31
            $lastMessage = $frame->getStream();
32
        });
33
34
        $buildStream->wait();
35
36
        $this->assertContains("Successfully built" ,$lastMessage);
37
    }
38
}
39