Attempt to fix tests again

This commit is contained in:
Timothy Warren 2018-10-29 10:07:20 -04:00
parent e84cbe1bb2
commit 1690d8c1e0
4 changed files with 17 additions and 398 deletions

View File

@ -195,7 +195,6 @@ final class JsonAPI {
}
$organized[$type][$id] = $newItem;
$organized[$type][$id]['original'] = $item;
}
// Second pass, go through and fill missing relationships in the first pass
@ -215,7 +214,6 @@ final class JsonAPI {
$relationship =& $organized[$type][$id]['relationships'][$relType];
unset($relationship['links']);
unset($relationship['data']);
$relationship['foo'] = TRUE;
if ($relType === $dataType)
{
@ -326,12 +324,13 @@ final class JsonAPI {
foreach($relationships as $key => $data)
{
$organized[$key] = $organized[$key] ?? [];
if ( ! array_key_exists('data', $data))
{
continue;
}
$organized[$key] = $organized[$key] ?? [];
foreach ($data['data'] as $item)
{
if (\is_array($item) && array_key_exists('id', $item))

View File

@ -39,6 +39,8 @@ class JsonAPITest extends TestCase {
$expected = $this->organizedIncludes;
$actual = JsonAPI::organizeIncludes($this->startData['included']);
// file_put_contents(__DIR__ . '/../test_data/JsonAPI/organizedIncludes.json', json_Encode($actual));
$this->assertEquals($expected, $actual);
}
@ -47,6 +49,8 @@ class JsonAPITest extends TestCase {
$expected = $this->inlineIncluded;
$actual = JsonAPI::inlineIncludedRelationships($this->organizedIncludes, 'anime');
// file_put_contents(__DIR__ . '/../test_data/JsonAPI/inlineIncluded.json', json_Encode($actual));
$this->assertEquals($expected, $actual);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long