Skip to content

Commit 90dd474

Browse files
SvenRtbgcweiske
authored andcommitted
Move 7.1 tests into regular object tests
We do not need to check for this version anymore
1 parent 342efeb commit 90dd474

File tree

2 files changed

+27
-53
lines changed

2 files changed

+27
-53
lines changed

tests/ObjectTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,32 @@ public function testConstructorWithOptionalParams()
221221

222222
$this->assertEquals('optional', $objs[0]->foo);
223223
}
224+
225+
/**
226+
* Test for PHP7 nullable types like "?Object"
227+
*/
228+
public function testObjectSetterTypeNullable()
229+
{
230+
$jm = new JsonMapper();
231+
$sn = $jm->map(
232+
json_decode('{"typeNullableObject":null}'),
233+
new JsonMapperTest_PHP7Object()
234+
);
235+
$this->assertNull($sn->typeNullableObject);
236+
}
237+
238+
/**
239+
* Test for non-nullable types like "@param object" with null value
240+
*/
241+
public function testObjectSetterDocblockInvalidNull()
242+
{
243+
$this->expectException(JsonMapper_Exception::class);
244+
$this->expectExceptionMessage('JSON property "nonNullableObject" in class "JsonMapperTest_PHP7Object" must not be NULL');
245+
$jm = new JsonMapper();
246+
$sn = $jm->map(
247+
json_decode('{"nonNullableObject":null}'),
248+
new JsonMapperTest_PHP7Object()
249+
);
250+
}
224251
}
225252
?>

tests/Object_PHP71_Test.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)