File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,6 +75,20 @@ public function testAsVersion() {
7575 $ this ->assertEquals ($ versioned , $ args , "success only: 1.0.0 " );
7676 }
7777
78+ // reported https://github.com/RusticiSoftware/TinCanPHP/issues/34
79+ public function testAsVersionScoreZeroRaw () {
80+ $ args = [
81+ 'score ' => [
82+ 'raw ' => 0 ,
83+ ]
84+ ];
85+
86+ $ obj = Result::fromJSON (json_encode ($ args , JSON_UNESCAPED_SLASHES ));
87+ $ versioned = $ obj ->asVersion ('1.0.0 ' );
88+
89+ $ this ->assertEquals ($ versioned , $ args , "serialized version matches original " );
90+ }
91+
7892 public function testCompareWithSignature () {
7993 $ score1 = new TinCan \Score (
8094 [
Original file line number Diff line number Diff line change @@ -216,4 +216,14 @@ public function testCompareWithSignature() {
216216 ];
217217 $ this ->runSignatureCases ("TinCan\Score " , $ cases );
218218 }
219+
220+ public function testZeroValue () {
221+ $ args = [
222+ 'raw ' => 0
223+ ];
224+ $ obj = new Score ($ args );
225+ $ versioned = $ obj ->asVersion ('1.0.0 ' );
226+
227+ $ this ->assertEquals ($ versioned , $ args , "raw with 0 as value " );
228+ }
219229}
You can’t perform that action at this time.
0 commit comments