Skip to content

Commit d55173e

Browse files
committed
Create test for bug
1 parent e41c7f8 commit d55173e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/Integration/ParsingTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,4 +612,19 @@ public function testParseCreateResourceWithoutId()
612612
// Test full array
613613
$this->assertEquals(json_decode($string, true), $document->asArray(true));
614614
}
615+
616+
/**
617+
* @test
618+
*/
619+
public function testParseCreateShortResourceWithoutId()
620+
{
621+
$string = $this->getJsonString('15_create_resource_without_id.json');
622+
$document = Helper::parseRequestBody($string);
623+
624+
$this->assertInstanceOf('Art4\JsonApiClient\Document', $document);
625+
$this->assertSame(['data'], $document->getKeys());
626+
627+
// Test full array
628+
$this->assertEquals(json_decode($string, true), $document->asArray(true));
629+
}
615630
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"data": {
3+
"type": "photos",
4+
"attributes": {
5+
"title": "Ember Hamster",
6+
"src": "http://example.com/images/productivity.png"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)