Test Failed
Push — master ( aaac43...739586 )
by Jonas
10:11
created

ShopConfigTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetFail() 0 5 1
A testGet() 0 12 1
A testGetFail2() 0 5 1
1
<?php
2
3
4
namespace Deployee\Plugins\ShopwareTasks\Shop;
5
6
7
use PHPUnit\Framework\TestCase;
8
9
class ShopConfigTest extends TestCase
10
{
11
    public function testGet()
12
    {
13
        $shopConfig = new ShopConfig(__DIR__ . '/.env');
14
15
        $this->assertSame('mysql', $shopConfig->get('type'));
16
        $this->assertSame('fooBarHost', $shopConfig->get('host'));
17
        $this->assertSame(3306, $shopConfig->get('port'));
18
        $this->assertSame('db', $shopConfig->get('dbname'));
19
        $this->assertSame('foo', $shopConfig->get('username'));
20
        $this->assertSame('bar', $shopConfig->get('password'));
21
22
        $this->assertNull($shopConfig->get('foobar'));
23
    }
24
25
    public function testGetFail()
26
    {
27
        $shopConfig = new ShopConfig('/file/dies/not/exist.php');
28
        $this->expectException(\InvalidArgumentException::class);
29
        $shopConfig->get('foo');
30
    }
31
32
    public function testGetFail2()
33
    {
34
        $shopConfig = new ShopConfig(__DIR__ . '/.empty_env');
35
        $this->expectException(\InvalidArgumentException::class);
36
        $shopConfig->get('foo');
37
    }
38
}