@@ -272,8 +272,8 @@ public function testCreateWithPropertyLengthRestriction(): void
272
272
273
273
$ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
274
274
$ validatorMetadataFactory ->getMetadataFor (DummyValidatedEntity::class)
275
- ->willReturn ($ validatorClassMetadata )
276
- ->shouldBeCalled ();
275
+ ->willReturn ($ validatorClassMetadata )
276
+ ->shouldBeCalled ();
277
277
278
278
$ decoratedPropertyMetadataFactory = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
279
279
$ property = 'dummy ' ;
@@ -283,7 +283,9 @@ public function testCreateWithPropertyLengthRestriction(): void
283
283
284
284
$ lengthRestrictions = new PropertySchemaLengthRestriction ();
285
285
$ validatorPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
286
- $ validatorMetadataFactory ->reveal (), $ decoratedPropertyMetadataFactory ->reveal (), [$ lengthRestrictions ]
286
+ $ validatorMetadataFactory ->reveal (),
287
+ $ decoratedPropertyMetadataFactory ->reveal (),
288
+ [$ lengthRestrictions ]
287
289
);
288
290
289
291
$ schema = $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, $ property )->getSchema ();
@@ -299,16 +301,17 @@ public function testCreateWithPropertyRegexRestriction(): void
299
301
300
302
$ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
301
303
$ validatorMetadataFactory ->getMetadataFor (DummyValidatedEntity::class)
302
- ->willReturn ($ validatorClassMetadata )
303
- ->shouldBeCalled ();
304
+ ->willReturn ($ validatorClassMetadata )
305
+ ->shouldBeCalled ();
304
306
305
307
$ decoratedPropertyMetadataFactory = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
306
308
$ decoratedPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummy ' , [])->willReturn (
307
309
new ApiProperty ()
308
310
)->shouldBeCalled ();
309
311
310
312
$ validationPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
311
- $ validatorMetadataFactory ->reveal (), $ decoratedPropertyMetadataFactory ->reveal (),
313
+ $ validatorMetadataFactory ->reveal (),
314
+ $ decoratedPropertyMetadataFactory ->reveal (),
312
315
[new PropertySchemaRegexRestriction ()]
313
316
);
314
317
@@ -326,8 +329,8 @@ public function testCreateWithPropertyFormatRestriction(string $property, string
326
329
327
330
$ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
328
331
$ validatorMetadataFactory ->getMetadataFor ($ class )
329
- ->willReturn ($ validatorClassMetadata )
330
- ->shouldBeCalled ();
332
+ ->willReturn ($ validatorClassMetadata )
333
+ ->shouldBeCalled ();
331
334
332
335
$ decoratedPropertyMetadataFactory = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
333
336
$ decoratedPropertyMetadataFactory ->create ($ class , $ property , [])->willReturn (
@@ -521,7 +524,8 @@ public function testCreateWithPropertyChoiceRestriction(ApiProperty $propertyMet
521
524
)->shouldBeCalled ();
522
525
523
526
$ validationPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
524
- $ validatorMetadataFactory ->reveal (), $ decoratedPropertyMetadataFactory ->reveal (),
527
+ $ validatorMetadataFactory ->reveal (),
528
+ $ decoratedPropertyMetadataFactory ->reveal (),
525
529
[new PropertySchemaChoiceRestriction ()]
526
530
);
527
531
@@ -558,7 +562,8 @@ public function testCreateWithPropertyCountRestriction(string $property, array $
558
562
)->shouldBeCalled ();
559
563
560
564
$ validationPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
561
- $ validatorMetadataFactory ->reveal (), $ decoratedPropertyMetadataFactory ->reveal (),
565
+ $ validatorMetadataFactory ->reveal (),
566
+ $ decoratedPropertyMetadataFactory ->reveal (),
562
567
[new PropertySchemaCountRestriction ()]
563
568
);
564
569
@@ -660,7 +665,8 @@ public function testCreateWithPropertyNumericRestriction(ApiProperty $propertyMe
660
665
)->shouldBeCalled ();
661
666
662
667
$ validationPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
663
- $ validatorMetadataFactory ->reveal (), $ decoratedPropertyMetadataFactory ->reveal (),
668
+ $ validatorMetadataFactory ->reveal (),
669
+ $ decoratedPropertyMetadataFactory ->reveal (),
664
670
[
665
671
new PropertySchemaGreaterThanOrEqualRestriction (),
666
672
new PropertySchemaGreaterThanRestriction (),
@@ -724,4 +730,22 @@ public static function provideNumericConstraintCases(): \Generator
724
730
'expectedSchema ' => ['maximum ' => 0 ],
725
731
];
726
732
}
733
+
734
+ public function testCallableGroup (): void
735
+ {
736
+ $ propertyMetadata = (new ApiProperty ())->withDescription ('A dummy group ' )->withReadable (true )->withWritable (true );
737
+
738
+ $ decoratedPropertyMetadataFactory = $ this ->prophesize (PropertyMetadataFactoryInterface::class);
739
+ $ decoratedPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummyGroup ' , ['validation_groups ' => [DummyValidatedEntity::class, 'getValidationGroups ' ]])->willReturn ($ propertyMetadata )->shouldBeCalled ();
740
+
741
+ $ validatorMetadataFactory = $ this ->prophesize (MetadataFactoryInterface::class);
742
+ $ validatorMetadataFactory ->getMetadataFor (DummyValidatedEntity::class)->willReturn ($ this ->validatorClassMetadata )->shouldBeCalled ();
743
+
744
+ $ validatorPropertyMetadataFactory = new ValidatorPropertyMetadataFactory (
745
+ $ validatorMetadataFactory ->reveal (),
746
+ $ decoratedPropertyMetadataFactory ->reveal (),
747
+ []
748
+ );
749
+ $ validatorPropertyMetadataFactory ->create (DummyValidatedEntity::class, 'dummyGroup ' , ['validation_groups ' => [DummyValidatedEntity::class, 'getValidationGroups ' ]]);
750
+ }
727
751
}
0 commit comments