Completed
Pull Request — master (#31)
by
unknown
02:18 queued 34s
created

JsonLoaderTest::testHasErrorWithWrongPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace ComposerRequireCheckerTest;
4
5
use ComposerRequireChecker\JsonLoader;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * @covers \ComposerRequireChecker\JsonLoader
10
 */
11
class JsonLoaderTest extends TestCase
12
{
13
14
    /**
15
     * @expectedException \ComposerRequireChecker\Exception\NotReadableException
16
     */
17
    public function testHasErrorWithWrongPath()
18
    {
19
        $path = __DIR__ . '/wrong/path/non-existing-file.json';
20
        new JsonLoader($path);
21
    }
22
23
    /**
24
     * @expectedException \ComposerRequireChecker\Exception\InvalidJsonException
25
     */
26
    public function testHasErrorWithInvalidFile()
27
    {
28
        $path = __DIR__ . '/../fixtures/invalidJson';
29
        new JsonLoader($path);
30
    }
31
32
    public function testHasDataWithValidFile()
33
    {
34
        $path = __DIR__ . '/../fixtures/validJson.json';
35
        $loader = new JsonLoader($path);
36
        $this->assertEquals($loader->getData(), ['foo' => 'bar']);
37
    }
38
39
}
40