Passed
Pull Request — master (#103)
by David
03:29
created

ImageServiceTest::testPull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TheAentMachine\Docker;
4
5
use Gamez\Psr\Log\TestLogger;
6
use PHPUnit\Framework\TestCase;
7
8
class ImageServiceTest extends TestCase
9
{
10
    public function testPull(): void
11
    {
12
        $logger = new TestLogger();
13
        $imageService = new ImageService($logger);
14
15
        $imageService->rmi('busybox:1.29.2');
16
17
        $imageService->pull('busybox:1.29.2');
18
        $log = $logger->log;
19
        $this->assertTrue($log->has('Pulling from library/busybox'));
20
    }
21
22
    public function testGetInternalPorts(): void
23
    {
24
        $logger = new TestLogger();
25
        $imageService = new ImageService($logger);
26
27
        $ports = $imageService->getInternalPorts('php:7.2-apache');
28
        $this->assertSame([80], $ports);
29
    }
30
31
    public function testGetVolumes(): void
32
    {
33
        $logger = new TestLogger();
34
        $imageService = new ImageService($logger);
35
36
        $ports = $imageService->getVolumes('mysql:5.7');
37
        $this->assertSame(['/var/lib/mysql'], $ports);
38
    }
39
}
40