blob: ee7db9ef5c62bda7e78b3be386305184afcecfaf (
plain)
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
28
|
<?php
namespace OpenCloud\Test\Common\JsonSchema;
use OpenCloud\Common\JsonSchema\JsonPatch;
use OpenCloud\Test\TestCase;
class JsonPatchTest extends TestCase
{
public function testAll()
{
$fixtures = json_decode(file_get_contents(__DIR__ . '/Fixtures/jsonPatchTests.json'));
foreach ($fixtures as $fixture) {
if (isset($fixture->disabled) || !isset($fixture->expected)) {
continue;
}
$actual = JsonPatch::diff($fixture->doc, $fixture->expected);
$this->assertEquals(
json_encode($fixture->patch, JSON_UNESCAPED_SLASHES),
json_encode($actual, JSON_UNESCAPED_SLASHES),
isset($fixture->comment) ? sprintf("Failed asserting test: %s\n", $fixture->comment) : ''
);
}
}
}
|