assertEquals(self::BASIC_JSON_ENCODED, json_encode($test)); } public function testDoubleJsonProperty(): void { $this->expectException(RuntimeException::class); $test = new class implements JsonSerializable { use JsonSerializableTrait; #[JsonProperty('test1')] #[JsonProperty('test2')] public string $stringVal = 'string value'; #[JsonProperty('test3')] #[JsonProperty('test4')] public function getIntVal(): int { return 1234; } }; json_encode($test); } public function testDuplicateJsonProperty(): void { $this->expectException(RuntimeException::class); $test = new class implements JsonSerializable { use JsonSerializableTrait; #[JsonProperty] public string $test1 = 'string value'; #[JsonProperty('test1')] public function getIntVal(): int { return 1234; } }; json_encode($test); } }