aboutsummaryrefslogtreecommitdiff
path: root/tests/Formats/JsonFormatTest.php
blob: 3b9f8d47e6c43c93b4924f7e741f94397bc80bf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
 * JsonFormat - JSON Feed Version 1
 * https://jsonfeed.org/version/1
 */

namespace RssBridge\Tests\Formats;

require_once __DIR__ . '/BaseFormatTest.php';

use PHPUnit\Framework\TestCase;

class JsonFormatTest extends BaseFormatTest {
	private const PATH_EXPECTED = self::PATH_SAMPLES . 'expectedJsonFormat/';

	/**
	 * @dataProvider sampleProvider
	 * @runInSeparateProcess
	 */
	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());

		$expected = self::PATH_EXPECTED . $name . '.json';
		$this->assertJsonStringEqualsJsonFile($expected, $data);
	}
}