From 4902627badccd2de4553c7406b7140d4eec2167e Mon Sep 17 00:00:00 2001 From: Pavel Batanov Date: Tue, 11 Sep 2018 13:57:22 +0300 Subject: [PATCH] Make SymfonyConstraintAnnotationReaderTest use proper calls to reader --- .../SymfonyConstraintAnnotationReaderTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php b/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php index dadbd6f..de60e24 100644 --- a/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php +++ b/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php @@ -32,15 +32,16 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase */ private $property2; }; - $reflectionProperties = (new \ReflectionClass($entity))->getProperties(); - $property = new Schema(); + $schema = new Schema(); + $schema->getProperties()->set('property1', new Schema()); + $schema->getProperties()->set('property2', new Schema()); $symfonyConstraintAnnotationReader = new SymfonyConstraintAnnotationReader(new AnnotationReader()); $symfonyConstraintAnnotationReader->setSchema($schema); - foreach ($reflectionProperties as $reflectionProperty) { - $symfonyConstraintAnnotationReader->updateProperty($reflectionProperty, $property); - } + + $symfonyConstraintAnnotationReader->updateProperty(new \ReflectionProperty($entity, 'property1'), $schema->getProperties()->get('property1')); + $symfonyConstraintAnnotationReader->updateProperty(new \ReflectionProperty($entity, 'property2'), $schema->getProperties()->get('property2')); // expect required to be numeric array with sequential keys (not [0 => ..., 2 => ...]) $this->assertEquals($schema->getRequired(), ['property1', 'property2']);