Passed
Branch master (e8fd46)
by Alexey
03:15
created

ParserJsonTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use Venta\Config\Parser\Json;
5
use Venta\Contracts\Config\Config;
6
7
class ParserJsonTest extends TestCase
8
{
9
10
    /**
11
     * @test
12
     */
13
    public function canParse()
14
    {
15
        $json = json_encode(['key' => 'value']);
16
        $parser = new Json();
17
        $config = $parser->parse($json);
18
19
        $this->assertInstanceOf(Config::class, $config);
20
        $this->assertSame('value', $config->get('key'));
21
    }
22
23
    /**
24
     * @test
25
     * @expectedException RuntimeException
26
     */
27
    public function throwsExceptionOnInvalidJsonString()
28
    {
29
        $parser = new Json();
30
        $config = $parser->parse('{"key":"value"');
31
    }
32
33
}
34