29
29
use Symfony \Bridge \Doctrine \Tests \Fixtures \SingleIntIdNoToStringEntity ;
30
30
use Symfony \Bridge \Doctrine \Tests \Fixtures \SingleStringCastableIdEntity ;
31
31
use Symfony \Bridge \Doctrine \Tests \Fixtures \SingleStringIdEntity ;
32
+ use Symfony \Component \Form \ChoiceList \LazyChoiceList ;
32
33
use Symfony \Component \Form \ChoiceList \View \ChoiceGroupView ;
33
34
use Symfony \Component \Form \ChoiceList \View \ChoiceView ;
35
+ use Symfony \Component \Form \Exception \RuntimeException ;
36
+ use Symfony \Component \Form \Exception \UnexpectedTypeException ;
34
37
use Symfony \Component \Form \Forms ;
35
38
use Symfony \Component \Form \Tests \Extension \Core \Type \BaseTypeTest ;
36
39
use Symfony \Component \Form \Tests \Extension \Core \Type \FormTypeTest ;
40
+ use Symfony \Component \OptionsResolver \Exception \InvalidOptionsException ;
41
+ use Symfony \Component \OptionsResolver \Exception \MissingOptionsException ;
37
42
38
43
class EntityTypeTest extends BaseTypeTest
39
44
{
@@ -118,13 +123,13 @@ protected function persist(array $entities)
118
123
119
124
public function testClassOptionIsRequired ()
120
125
{
121
- $ this ->expectException (\ Symfony \ Component \ OptionsResolver \ Exception \ MissingOptionsException::class);
126
+ $ this ->expectException (MissingOptionsException::class);
122
127
$ this ->factory ->createNamed ('name ' , static ::TESTED_TYPE );
123
128
}
124
129
125
130
public function testInvalidClassOption ()
126
131
{
127
- $ this ->expectException (\ Symfony \ Component \ Form \ Exception \ RuntimeException::class);
132
+ $ this ->expectException (RuntimeException::class);
128
133
$ this ->factory ->createNamed ('name ' , static ::TESTED_TYPE , null , [
129
134
'class ' => 'foo ' ,
130
135
]);
@@ -219,7 +224,7 @@ public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder()
219
224
220
225
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure ()
221
226
{
222
- $ this ->expectException (\ Symfony \ Component \ OptionsResolver \ Exception \ InvalidOptionsException::class);
227
+ $ this ->expectException (InvalidOptionsException::class);
223
228
$ this ->factory ->createNamed ('name ' , static ::TESTED_TYPE , null , [
224
229
'em ' => 'default ' ,
225
230
'class ' => self ::SINGLE_IDENT_CLASS ,
@@ -229,7 +234,7 @@ public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
229
234
230
235
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder ()
231
236
{
232
- $ this ->expectException (\ Symfony \ Component \ Form \ Exception \ UnexpectedTypeException::class);
237
+ $ this ->expectException (UnexpectedTypeException::class);
233
238
$ field = $ this ->factory ->createNamed ('name ' , static ::TESTED_TYPE , null , [
234
239
'em ' => 'default ' ,
235
240
'class ' => self ::SINGLE_IDENT_CLASS ,
@@ -1242,7 +1247,7 @@ public function testLoaderCaching()
1242
1247
$ choiceList2 = $ form ->get ('property2 ' )->getConfig ()->getAttribute ('choice_list ' );
1243
1248
$ choiceList3 = $ form ->get ('property3 ' )->getConfig ()->getAttribute ('choice_list ' );
1244
1249
1245
- $ this ->assertInstanceOf (\ Symfony \ Component \ Form \ ChoiceList \ LazyChoiceList::class, $ choiceList1 );
1250
+ $ this ->assertInstanceOf (LazyChoiceList::class, $ choiceList1 );
1246
1251
$ this ->assertSame ($ choiceList1 , $ choiceList2 );
1247
1252
$ this ->assertSame ($ choiceList1 , $ choiceList3 );
1248
1253
}
@@ -1302,14 +1307,14 @@ public function testLoaderCachingWithParameters()
1302
1307
$ choiceList2 = $ form ->get ('property2 ' )->getConfig ()->getAttribute ('choice_list ' );
1303
1308
$ choiceList3 = $ form ->get ('property3 ' )->getConfig ()->getAttribute ('choice_list ' );
1304
1309
1305
- $ this ->assertInstanceOf (\ Symfony \ Component \ Form \ ChoiceList \ LazyChoiceList::class, $ choiceList1 );
1310
+ $ this ->assertInstanceOf (LazyChoiceList::class, $ choiceList1 );
1306
1311
$ this ->assertSame ($ choiceList1 , $ choiceList2 );
1307
1312
$ this ->assertSame ($ choiceList1 , $ choiceList3 );
1308
1313
}
1309
1314
1310
1315
protected function createRegistryMock ($ name , $ em )
1311
1316
{
1312
- $ registry = $ this ->getMockBuilder (ManagerRegistry::class)-> getMock ( );
1317
+ $ registry = $ this ->createMock (ManagerRegistry::class);
1313
1318
$ registry ->expects ($ this ->any ())
1314
1319
->method ('getManager ' )
1315
1320
->with ($ this ->equalTo ($ name ))
0 commit comments