|
@@ 20-28 (lines=9) @@
|
| 17 |
|
$this->assertNull($loader->getData()); |
| 18 |
|
} |
| 19 |
|
|
| 20 |
|
public function testHasErrorWithInvalidFile() |
| 21 |
|
{ |
| 22 |
|
$path = __DIR__ . '/../fixtures/invalidJson'; |
| 23 |
|
$loader = new JsonLoader($path); |
| 24 |
|
$this->assertEquals($loader->getErrorCode(), JsonLoader::ERROR_INVALID_JSON); |
| 25 |
|
$this->assertEquals($loader->getPath(), $path); |
| 26 |
|
$this->assertNotEmpty($loader->getErrorMessage()); |
| 27 |
|
$this->assertNull($loader->getData()); |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public function testHasDataWithValidFile() |
| 31 |
|
{ |
|
@@ 30-38 (lines=9) @@
|
| 27 |
|
$this->assertNull($loader->getData()); |
| 28 |
|
} |
| 29 |
|
|
| 30 |
|
public function testHasDataWithValidFile() |
| 31 |
|
{ |
| 32 |
|
$path = __DIR__ . '/../fixtures/validJson.json'; |
| 33 |
|
$loader = new JsonLoader($path); |
| 34 |
|
$this->assertEquals($loader->getErrorCode(), JsonLoader::NO_ERROR); |
| 35 |
|
$this->assertEquals($loader->getPath(), $path); |
| 36 |
|
$this->assertEmpty($loader->getErrorMessage()); |
| 37 |
|
$this->assertEquals($loader->getData(), ['foo' => 'bar']); |
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
} |
| 41 |
|
|