diff --git a/tests/Serializer/JsonSerializationTest.php b/tests/Serializer/JsonSerializationTest.php index 7f59ca0d7..9eed054e2 100644 --- a/tests/Serializer/JsonSerializationTest.php +++ b/tests/Serializer/JsonSerializationTest.php @@ -28,6 +28,7 @@ use JMS\Serializer\Visitor\Factory\JsonSerializationVisitorFactory; use JMS\Serializer\Visitor\SerializationVisitorInterface; use PHPUnit\Framework\Attributes\DataProvider; +use TypeError; class JsonSerializationTest extends BaseSerializationTestCase { @@ -487,6 +488,7 @@ public function testFalseDataType() { if (PHP_VERSION_ID < 80200) { $this->markTestSkipped('False type requires PHP 8.2'); + return; } @@ -500,11 +502,10 @@ public function testFalseDataType() $this->deserialize(static::getContent('data_false'), DataFalse::class), ); - //What should we expect here? - self::assertEquals( - null, - $this->deserialize(static::getContent('data_true'), DataFalse::class), - ); + $this->expectException(TypeError::class); + $this->expectExceptionMessage('Cannot assign true to property JMS\Serializer\Tests\Fixtures\DataFalse::$data of type false'); + + $this->deserialize(static::getContent('data_true'), DataFalse::class); } public function testDeserializingComplexDiscriminatedUnionProperties()