@@ -69,11 +69,12 @@ protected function setUp(): void
69
69
70
70
public function testCreateWithPropertyWithRequiredConstraints (): void
71
71
{
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 );
74
74
75
75
$ 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 ();
77
78
78
79
$ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
79
80
$ validatorMetadataFactory ->getMetadataFor (DummyValidatedEntity::class)->willReturn ($ this ->validatorClassMetadata )->shouldBeCalled ();
@@ -83,9 +84,16 @@ public function testCreateWithPropertyWithRequiredConstraints(): void
83
84
$ decoratedPropertyMetadataFactory ->reveal (),
84
85
[]
85
86
);
86
- $ resultedPropertyMetadata = $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' );
87
87
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
+ );
89
97
}
90
98
91
99
public function testCreateWithPropertyWithNotRequiredConstraints (): void
0 commit comments