@@ -93,6 +93,7 @@ public function testSupportNormalizationAndSupportDenormalization(): void
9393 public function testNormalize (): void
9494 {
9595 $ relatedDummy = new RelatedDummy ();
96+ $ relatedDummy ->setId (2 );
9697
9798 $ dummy = new Dummy ();
9899 $ dummy ->setName ('foo ' );
@@ -146,6 +147,7 @@ public function testNormalize(): void
146147 $ serializerProphecy = $ this ->prophesize (SerializerInterface::class);
147148 $ serializerProphecy ->willImplement (NormalizerInterface::class);
148149 $ serializerProphecy ->normalize ('foo ' , null , Argument::type ('array ' ))->willReturn ('foo ' );
150+ $ serializerProphecy ->normalize ('/dummies/2 ' , null , Argument::type ('array ' ))->willReturn ('/dummies/2 ' );
149151 $ serializerProphecy ->normalize (['/dummies/2 ' ], null , Argument::type ('array ' ))->willReturn (['/dummies/2 ' ]);
150152
151153 $ normalizer = new class ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ iriConverterProphecy ->reveal (), $ resourceClassResolverProphecy ->reveal (), $ propertyAccessorProphecy ->reveal (), null , null , [], null , null ) extends AbstractItemNormalizer {};
@@ -289,11 +291,26 @@ public function testNormalizePropertyAsIriWithUriTemplate(): void
289291 $ resourceClassResolverProphecy ->isResourceClass (PropertyCollectionIriOnlyRelation::class)->willReturn (true );
290292 $ resourceClassResolverProphecy ->getResourceClass ([$ propertyCollectionIriOnlyRelation ], PropertyCollectionIriOnlyRelation::class)->willReturn (PropertyCollectionIriOnlyRelation::class);
291293
292- $ normalizer = new class ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ iriConverterProphecy ->reveal (), $ resourceClassResolverProphecy ->reveal (), new PropertyAccessor (), // $propertyAccessorProphecy->reveal(),
293- null , null , [], $ resourceMetadataCollectionFactoryProphecy ->reveal (), null , ) extends AbstractItemNormalizer {};
294+ $ normalizer = new class (
295+ $ propertyNameCollectionFactoryProphecy ->reveal (),
296+ $ propertyMetadataFactoryProphecy ->reveal (),
297+ $ iriConverterProphecy ->reveal (),
298+ $ resourceClassResolverProphecy ->reveal (),
299+ new PropertyAccessor (), // $propertyAccessorProphecy->reveal(),
300+ null ,
301+ null ,
302+ [],
303+ $ resourceMetadataCollectionFactoryProphecy ->reveal (),
304+ null ,
305+ ) extends AbstractItemNormalizer {};
294306
295307 $ serializerProphecy = $ this ->prophesize (SerializerInterface::class);
296308 $ serializerProphecy ->willImplement (NormalizerInterface::class);
309+ // This is the fix: we must ensure normalize returns the IRIs as strings, not null
310+ $ serializerProphecy ->normalize ('/property-collection-relations ' , Argument::cetera ())->willReturn ('/property-collection-relations ' );
311+ $ serializerProphecy ->normalize ('/parent/42/another-collection-operations ' , Argument::cetera ())->willReturn ('/parent/42/another-collection-operations ' );
312+ $ serializerProphecy ->normalize ('/parent/42/another-collection-operations/24 ' , Argument::cetera ())->willReturn ('/parent/42/another-collection-operations/24 ' );
313+
297314 $ normalizer ->setSerializer ($ serializerProphecy ->reveal ());
298315
299316 $ expected = [
@@ -1642,7 +1659,7 @@ public function testDenormalizeBasicTypePropertiesFromXml(): void
16421659 $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'float1 ' , Argument::approximate (123.456 , 0 ))->shouldBeCalled ();
16431660 $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'float2 ' , Argument::approximate (-1.2344e56 , 1 ))->shouldBeCalled ();
16441661 $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'float3 ' , Argument::approximate (45E-6 , 1 ))->shouldBeCalled ();
1645- $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'floatNaN ' , Argument::that (static fn (float $ arg ) => is_nan ($ arg )))->shouldBeCalled ();
1662+ $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'floatNaN ' , Argument::that (static fn (float $ arg ) => is_nan ($ arg )))->shouldBeCalled ();
16461663 $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'floatInf ' , \INF )->shouldBeCalled ();
16471664 $ propertyAccessorProphecy ->setValue (Argument::type (ObjectWithBasicProperties::class), 'floatNegInf ' , -\INF )->shouldBeCalled ();
16481665
@@ -1864,6 +1881,7 @@ public function testCacheKey(): void
18641881 $ serializerProphecy = $ this ->prophesize (SerializerInterface::class);
18651882 $ serializerProphecy ->willImplement (NormalizerInterface::class);
18661883 $ serializerProphecy ->normalize ('foo ' , null , Argument::type ('array ' ))->willReturn ('foo ' );
1884+ $ serializerProphecy ->normalize ('/dummies/2 ' , null , Argument::type ('array ' ))->willReturn ('/dummies/2 ' );
18671885 $ serializerProphecy ->normalize (['/dummies/2 ' ], null , Argument::type ('array ' ))->willReturn (['/dummies/2 ' ]);
18681886
18691887 $ normalizer = new class ($ propertyNameCollectionFactoryProphecy ->reveal (), $ propertyMetadataFactoryProphecy ->reveal (), $ iriConverterProphecy ->reveal (), $ resourceClassResolverProphecy ->reveal (), $ propertyAccessorProphecy ->reveal (), null , null , [], null , null ) extends AbstractItemNormalizer {};
0 commit comments