@@ -956,7 +956,32 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifie
956
956
$ this ->assertNull ($ field ->getData ());
957
957
}
958
958
959
- public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifierWithLimit ()
959
+ public function testSingleIdentifierWithLimit ()
960
+ {
961
+ $ entity1 = new SingleIntIdEntity (1 , 'Foo ' );
962
+ $ entity2 = new SingleIntIdEntity (2 , 'Bar ' );
963
+ $ entity3 = new SingleIntIdEntity (3 , 'Baz ' );
964
+
965
+ $ this ->persist ([$ entity1 , $ entity2 , $ entity3 ]);
966
+
967
+ $ repository = $ this ->em ->getRepository (self ::SINGLE_IDENT_CLASS );
968
+
969
+ $ field = $ this ->factory ->createNamed ('name ' , static ::TESTED_TYPE , null , [
970
+ 'em ' => 'default ' ,
971
+ 'class ' => self ::SINGLE_IDENT_CLASS ,
972
+ 'query_builder ' => $ repository ->createQueryBuilder ('e ' )
973
+ ->where ('e.id IN (1, 2, 3) ' )
974
+ ->setMaxResults (1 ),
975
+ 'choice_label ' => 'name ' ,
976
+ ]);
977
+
978
+ $ field ->submit ('1 ' );
979
+
980
+ $ this ->assertTrue ($ field ->isSynchronized ());
981
+ $ this ->assertSame ($ entity1 , $ field ->getData ());
982
+ }
983
+
984
+ public function testDisallowChoicesThatAreNotIncludedByQueryBuilderSingleIdentifierWithLimit ()
960
985
{
961
986
$ entity1 = new SingleIntIdEntity (1 , 'Foo ' );
962
987
$ entity2 = new SingleIntIdEntity (2 , 'Bar ' );
0 commit comments