@@ -45,6 +45,7 @@ public function testLoadClassMetadata()
4545 'alreadyMappedNotNull ' ,
4646 'alreadyMappedNotBlank ' ,
4747 'alreadyPartiallyMappedCollection ' ,
48+ 'readOnly ' ,
4849 ])
4950 ;
5051 $ propertyInfoStub
@@ -58,11 +59,27 @@ public function testLoadClassMetadata()
5859 [new Type (Type::BUILTIN_TYPE_FLOAT , true )], // The existing constraint is float
5960 [new Type (Type::BUILTIN_TYPE_STRING , true )],
6061 [new Type (Type::BUILTIN_TYPE_STRING , true )],
61- [new Type (Type::BUILTIN_TYPE_ARRAY , true , null , true , null , new Type (Type::BUILTIN_TYPE_FLOAT ))]
62+ [new Type (Type::BUILTIN_TYPE_ARRAY , true , null , true , null , new Type (Type::BUILTIN_TYPE_FLOAT ))],
63+ [new Type (Type::BUILTIN_TYPE_STRING )]
64+ ))
65+ ;
66+ $ propertyInfoStub
67+ ->method ('isWritable ' )
68+ ->will ($ this ->onConsecutiveCalls (
69+ true ,
70+ true ,
71+ true ,
72+ true ,
73+ true ,
74+ true ,
75+ true ,
76+ true ,
77+ true ,
78+ false
6279 ))
6380 ;
6481
65- $ propertyInfoLoader = new PropertyInfoLoader ($ propertyInfoStub , $ propertyInfoStub );
82+ $ propertyInfoLoader = new PropertyInfoLoader ($ propertyInfoStub , $ propertyInfoStub, $ propertyInfoStub );
6683
6784 $ validator = Validation::createValidatorBuilder ()
6885 ->enableAnnotationMapping ()
@@ -137,6 +154,9 @@ public function testLoadClassMetadata()
137154 $ this ->assertSame ('string ' , $ alreadyPartiallyMappedCollectionConstraints [0 ]->constraints [0 ]->type );
138155 $ this ->assertInstanceOf (Iban::class, $ alreadyPartiallyMappedCollectionConstraints [0 ]->constraints [1 ]);
139156 $ this ->assertInstanceOf (NotNull::class, $ alreadyPartiallyMappedCollectionConstraints [0 ]->constraints [2 ]);
157+
158+ $ readOnlyMetadata = $ classMetadata ->getPropertyMetadata ('readOnly ' );
159+ $ this ->assertEmpty ($ readOnlyMetadata );
140160 }
141161
142162 /**
@@ -154,7 +174,7 @@ public function testClassValidator(bool $expected, string $classValidatorRegexp
154174 ->willReturn ([new Type (Type::BUILTIN_TYPE_STRING )])
155175 ;
156176
157- $ propertyInfoLoader = new PropertyInfoLoader ($ propertyInfoStub , $ propertyInfoStub , $ classValidatorRegexp );
177+ $ propertyInfoLoader = new PropertyInfoLoader ($ propertyInfoStub , $ propertyInfoStub , $ propertyInfoStub , $ classValidatorRegexp );
158178
159179 $ classMetadata = new ClassMetadata (PropertyInfoLoaderEntity::class);
160180 $ this ->assertSame ($ expected , $ propertyInfoLoader ->loadClassMetadata ($ classMetadata ));
0 commit comments