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 2
2
All notable changes to this project will be documented in this file. This project adheres to
3
3
[ Semantic Versioning] ( http://semver.org/ ) and [ this changelog format] ( http://keepachangelog.com/ ) .
4
4
5
+ ## Unreleased
6
+
7
+ ### Fixed
8
+ - [ #445 ] ( https://github.com/cloudcreativity/laravel-json-api/issues/445 )
9
+ Allow resource identifier to be zero.
10
+
5
11
## [ 1.5.0] - 2019-10-14
6
12
7
13
### Added
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function getId()
75
75
throw new RuntimeException ('Id member is not a string. ' );
76
76
}
77
77
78
- if (empty ($ id )) {
78
+ if (empty ($ id ) && ' 0 ' !== $ id ) {
79
79
throw new RuntimeException ('Id member is an empty string. ' );
80
80
}
81
81
Original file line number Diff line number Diff line change @@ -146,4 +146,10 @@ public function testInvalidId($id)
146
146
$ this ->expectException (RuntimeException::class);
147
147
ResourceIdentifier::create ('posts ' , $ id )->getId ();
148
148
}
149
+
150
+ public function testZeroId ()
151
+ {
152
+ $ identifier = ResourceIdentifier::create ('posts ' , '0 ' );
153
+ $ this ->assertSame ('0 ' , $ identifier ->getId ());
154
+ }
149
155
}
You can’t perform that action at this time.
0 commit comments