@@ -36,49 +36,30 @@ public function testProcess()
36
36
37
37
$ controllers = $ container ->getDefinition ((string ) $ resolver ->getArgument (0 ))->getArgument (0 );
38
38
39
- $ this ->assertCount (2 , $ container ->getDefinition ((string ) $ controllers ['c1:fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
40
- $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:setTestCase ' ]->getValues ()[0 ])->getArgument (0 ));
41
- $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
39
+ $ this ->assertCount (2 , $ container ->getDefinition ((string ) $ controllers ['c1:: fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
40
+ $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:: setTestCase ' ]->getValues ()[0 ])->getArgument (0 ));
41
+ $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:: fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
42
42
43
43
(new ResolveInvalidReferencesPass ())->process ($ container );
44
44
45
- $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:setTestCase ' ]->getValues ()[0 ])->getArgument (0 ));
46
- $ this ->assertSame (array (), $ container ->getDefinition ((string ) $ controllers ['c2:fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
45
+ $ this ->assertCount (1 , $ container ->getDefinition ((string ) $ controllers ['c2:: setTestCase ' ]->getValues ()[0 ])->getArgument (0 ));
46
+ $ this ->assertSame (array (), $ container ->getDefinition ((string ) $ controllers ['c2:: fooAction ' ]->getValues ()[0 ])->getArgument (0 ));
47
47
48
48
(new RemoveEmptyControllerArgumentLocatorsPass ())->process ($ container );
49
49
50
50
$ controllers = $ container ->getDefinition ((string ) $ resolver ->getArgument (0 ))->getArgument (0 );
51
51
52
- $ this ->assertSame (array ('c1:fooAction ' ), array_keys ($ controllers ));
53
- $ this ->assertSame (array ('bar ' ), array_keys ($ container ->getDefinition ((string ) $ controllers ['c1:fooAction ' ]->getValues ()[0 ])->getArgument (0 )));
52
+ $ this ->assertSame (array ('c1::fooAction ' , ' c1: fooAction ' ), array_keys ($ controllers ));
53
+ $ this ->assertSame (array ('bar ' ), array_keys ($ container ->getDefinition ((string ) $ controllers ['c1:: fooAction ' ]->getValues ()[0 ])->getArgument (0 )));
54
54
55
55
$ expectedLog = array (
56
- 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing service-argument resolver for controller "c2:fooAction": no corresponding services exist for the referenced types. ' ,
56
+ 'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing service-argument resolver for controller "c2:: fooAction": no corresponding services exist for the referenced types. ' ,
57
57
'Symfony\Component\HttpKernel\DependencyInjection\RemoveEmptyControllerArgumentLocatorsPass: Removing method "setTestCase" of service "c2" from controller candidates: the method is called at instantiation, thus cannot be an action. ' ,
58
58
);
59
59
60
60
$ this ->assertSame ($ expectedLog , $ container ->getCompiler ()->getLog ());
61
61
}
62
62
63
- public function testSameIdClass ()
64
- {
65
- $ container = new ContainerBuilder ();
66
- $ resolver = $ container ->register ('argument_resolver.service ' )->addArgument (array ());
67
-
68
- $ container ->register (RegisterTestController::class, RegisterTestController::class)
69
- ->addTag ('controller.service_arguments ' )
70
- ;
71
-
72
- (new RegisterControllerArgumentLocatorsPass ())->process ($ container );
73
- (new RemoveEmptyControllerArgumentLocatorsPass ())->process ($ container );
74
-
75
- $ expected = array (
76
- RegisterTestController::class.':fooAction ' ,
77
- RegisterTestController::class.'::fooAction ' ,
78
- );
79
- $ this ->assertEquals ($ expected , array_keys ($ container ->getDefinition ((string ) $ resolver ->getArgument (0 ))->getArgument (0)));
80
- }
81
-
82
63
public function testInvoke ()
83
64
{
84
65
$ container = new ContainerBuilder ();
@@ -92,30 +73,10 @@ public function testInvoke()
92
73
(new RemoveEmptyControllerArgumentLocatorsPass ())->process ($ container );
93
74
94
75
$ this ->assertEquals (
95
- array ('invokable:__invoke ' , 'invokable ' ),
76
+ array ('invokable::__invoke ' , ' invokable: __invoke ' , 'invokable ' ),
96
77
array_keys ($ container ->getDefinition ((string ) $ resolver ->getArgument (0 ))->getArgument (0 ))
97
78
);
98
79
}
99
-
100
- public function testInvokeSameIdClass ()
101
- {
102
- $ container = new ContainerBuilder ();
103
- $ resolver = $ container ->register ('argument_resolver.service ' )->addArgument (array ());
104
-
105
- $ container ->register (InvokableRegisterTestController::class, InvokableRegisterTestController::class)
106
- ->addTag ('controller.service_arguments ' )
107
- ;
108
-
109
- (new RegisterControllerArgumentLocatorsPass ())->process ($ container );
110
- (new RemoveEmptyControllerArgumentLocatorsPass ())->process ($ container );
111
-
112
- $ expected = array (
113
- InvokableRegisterTestController::class.':__invoke ' ,
114
- InvokableRegisterTestController::class.'::__invoke ' ,
115
- InvokableRegisterTestController::class,
116
- );
117
- $ this ->assertEquals ($ expected , array_keys ($ container ->getDefinition ((string ) $ resolver ->getArgument (0 ))->getArgument (0 )));
118
- }
119
80
}
120
81
121
82
class RemoveTestController1
0 commit comments