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

ShopConfigTest::testGetFail2()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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
}