@@ -69,11 +69,12 @@ protected function setUp(): void
6969
7070 public function testCreateWithPropertyWithRequiredConstraints (): void
7171 {
72- $ propertyMetadata = (new ApiProperty ())->withDescription ('A dummy ' )->withReadable (true )->withWritable (true );
73- $ expectedPropertyMetadata = $ propertyMetadata -> withRequired (true );
72+ $ dummyPropertyMetadata = (new ApiProperty ())->withDescription ('A dummy ' )->withReadable (true )->withWritable (true );
73+ $ emailPropertyMetadata = ( new ApiProperty ())-> withTypes ([ ' https://schema.org/email ' ])-> withReadable ( true )-> withWritable (true );
7474
7575 $ decoratedPropertyMetadataFactory = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
76- $ decoratedPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' , [])->willReturn ($ propertyMetadata )->shouldBeCalled ();
76+ $ decoratedPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' , [])->willReturn ($ dummyPropertyMetadata )->shouldBeCalled ();
77+ $ decoratedPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummyEmail ' , [])->willReturn ($ emailPropertyMetadata )->shouldBeCalled ();
7778
7879 $ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
7980 $ validatorMetadataFactory ->getMetadataFor (DummyValidatedEntity::class)->willReturn ($ this ->validatorClassMetadata )->shouldBeCalled ();
@@ -83,9 +84,16 @@ public function testCreateWithPropertyWithRequiredConstraints(): void
8384 $ decoratedPropertyMetadataFactory ->reveal (),
8485 []
8586 );
86- $ resultedPropertyMetadata = $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' );
8787
88- $ this ->assertEquals ($ expectedPropertyMetadata , $ resultedPropertyMetadata );
88+ $ this ->assertEquals (
89+ $ dummyPropertyMetadata ->withRequired (true ),
90+ $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' ),
91+ );
92+
93+ $ this ->assertEquals (
94+ $ emailPropertyMetadata ->withRequired (false ),
95+ $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummyEmail ' ),
96+ );
8997 }
9098
9199 public function testCreateWithPropertyWithNotRequiredConstraints (): void
0 commit comments