2019-01-05 15:20:11 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-01-05 15:20:11 +03:00
|
|
|
/**
|
|
|
|
* JsonFormat - JSON Feed Version 1
|
|
|
|
* https://jsonfeed.org/version/1
|
|
|
|
*/
|
|
|
|
|
2022-06-08 00:22:33 +03:00
|
|
|
namespace RssBridge\Tests\Formats;
|
|
|
|
|
2022-06-08 03:17:32 +03:00
|
|
|
require_once __DIR__ . '/BaseFormatTest.php';
|
2019-01-05 15:20:11 +03:00
|
|
|
|
2022-06-08 03:17:32 +03:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2019-01-05 15:20:11 +03:00
|
|
|
|
2022-06-08 03:17:32 +03:00
|
|
|
class JsonFormatTest extends BaseFormatTest
|
|
|
|
{
|
|
|
|
private const PATH_EXPECTED = self::PATH_SAMPLES . 'expectedJsonFormat/';
|
2019-01-05 15:20:11 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider sampleProvider
|
|
|
|
* @runInSeparateProcess
|
|
|
|
*/
|
2022-06-08 03:17:32 +03:00
|
|
|
public function testOutput(string $name, string $path)
|
|
|
|
{
|
|
|
|
$data = $this->formatData('Json', $this->loadSample($path));
|
|
|
|
$this->assertNotNull(json_decode($data), 'invalid JSON output: ' . json_last_error_msg());
|
2019-01-05 15:20:11 +03:00
|
|
|
|
2022-06-08 03:17:32 +03:00
|
|
|
$expected = self::PATH_EXPECTED . $name . '.json';
|
|
|
|
$this->assertJsonStringEqualsJsonFile($expected, $data);
|
2019-01-05 15:20:11 +03:00
|
|
|
}
|
|
|
|
}
|