Passed
Pull Request — master (#26)
by Dominik
01:09
created

testForLocationFailsWithoutValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace ACFComposer\Tests;
4
5
require_once dirname(__DIR__) . '/lib/ACFComposer/ResolveConfig.php';
6
7
use Exception;
8
use ACFComposer\ResolveConfig;
9
10
final class ResolveConfigForLocationTest extends TestCase
11
{
12
    public function testForLocationWithValidConfig()
13
    {
14
        $config = [
15
            'param' => 'someParam',
16
            'operator' => 'someOperator',
17
            'value' => 'someValue'
18
        ];
19
        $output = ResolveConfig::forLocation($config);
20
        $this->assertEquals($config, $output);
21
    }
22
23
    public function testForLocationFailsWithoutParam()
24
    {
25
        $config = [
26
            'operator' => 'someOperator',
27
            'value' => 'someValue'
28
        ];
29
        $this->expectException(Exception::class);
30
        ResolveConfig::forLocation($config);
31
    }
32
33
    public function testForLocationFailsWithoutOperator()
34
    {
35
        $config = [
36
            'param' => 'someParam',
37
            'value' => 'someValue'
38
        ];
39
        $this->expectException(Exception::class);
40
        ResolveConfig::forLocation($config);
41
    }
42
43
    public function testForLocationFailsWithoutValue()
44
    {
45
        $config = [
46
            'param' => 'someParam',
47
            'operator' => 'someOperator',
48
        ];
49
        $this->expectException(Exception::class);
50
        ResolveConfig::forLocation($config);
51
    }
52
}
53