File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 22All notable changes to this project will be documented in this file. This project adheres to
33[ Semantic Versioning] ( http://semver.org/ ) and [ this changelog format] ( http://keepachangelog.com/ ) .
44
5+ ## Unreleased
6+
7+ ### Fixed
8+ - [ #445 ] ( https://github.com/cloudcreativity/laravel-json-api/issues/445 )
9+ Allow resource identifier to be zero.
10+
511## [ 1.5.0] - 2019-10-14
612
713### Added
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function getId()
7575 throw new RuntimeException ('Id member is not a string. ' );
7676 }
7777
78- if (empty ($ id )) {
78+ if (empty ($ id ) && ' 0 ' !== $ id ) {
7979 throw new RuntimeException ('Id member is an empty string. ' );
8080 }
8181
Original file line number Diff line number Diff line change @@ -146,4 +146,10 @@ public function testInvalidId($id)
146146 $ this ->expectException (RuntimeException::class);
147147 ResourceIdentifier::create ('posts ' , $ id )->getId ();
148148 }
149+
150+ public function testZeroId ()
151+ {
152+ $ identifier = ResourceIdentifier::create ('posts ' , '0 ' );
153+ $ this ->assertSame ('0 ' , $ identifier ->getId ());
154+ }
149155}
You can’t perform that action at this time.
0 commit comments