44
55use PHPUnit \Framework \TestCase ;
66use Symfony \Bundle \MakerBundle \Command \AbstractCommand ;
7+ use Symfony \Bundle \MakerBundle \Command \MakeAuthenticatorCommand ;
78use Symfony \Bundle \MakerBundle \Command \MakeCommandCommand ;
89use Symfony \Bundle \MakerBundle \Command \MakeControllerCommand ;
910use Symfony \Bundle \MakerBundle \Command \MakeEntityCommand ;
@@ -48,7 +49,7 @@ public function tearDown()
4849 */
4950 public function testCommands (AbstractCommand $ command , array $ inputs )
5051 {
51- /** @var AbstractCommand $command */
52+ /* @var AbstractCommand $command */
5253 $ command ->setCheckDependencies (false );
5354 $ command ->setGenerator ($ this ->createGenerator ());
5455
@@ -71,128 +72,136 @@ public function testCommands(AbstractCommand $command, array $inputs)
7172 public function getCommandTests ()
7273 {
7374 $ generator = $ this ->createGenerator ();
74- $ commands = [] ;
75+ $ commands = array () ;
7576
76- $ commands ['command ' ] = [
77+ $ commands ['command ' ] = array (
7778 new MakeCommandCommand ($ generator ),
78- [
79+ array (
7980 // command name
80- 'app:foo '
81- ]
82- ] ;
81+ 'app:foo ' ,
82+ ),
83+ ) ;
8384
8485 $ router = $ this ->createMock (RouterInterface::class);
8586 $ router ->expects ($ this ->once ())
8687 ->method ('getRouteCollection ' )
8788 ->willReturn (new RouteCollection ());
88- $ commands ['controller ' ] = [
89+ $ commands ['controller ' ] = array (
8990 new MakeControllerCommand ($ generator , $ router ),
90- [
91+ array (
9192 // controller class name
92- 'FooBar '
93- ]
94- ] ;
93+ 'FooBar ' ,
94+ ),
95+ ) ;
9596
96- $ commands ['entity ' ] = [
97+ $ commands ['entity ' ] = array (
9798 new MakeEntityCommand ($ generator ),
98- [
99+ array (
99100 // entity class name
100- 'FooBar '
101- ]
102- ] ;
101+ 'FooBar ' ,
102+ ),
103+ ) ;
103104
104- $ commands ['form ' ] = [
105+ $ commands ['form ' ] = array (
105106 new MakeFormCommand ($ generator ),
106- [
107+ array (
107108 // form name
108- 'FooBar '
109- ]
110- ] ;
109+ 'FooBar ' ,
110+ ),
111+ ) ;
111112
112- $ commands ['functional ' ] = [
113+ $ commands ['functional ' ] = array (
113114 new MakeFunctionalTestCommand ($ generator ),
114- [
115+ array (
115116 // functional test class
116- 'FooBar '
117- ]
118- ] ;
117+ 'FooBar ' ,
118+ ),
119+ ) ;
119120
120121 $ eventRegistry = $ this ->createMock (EventRegistry::class);
121122 $ eventRegistry ->expects ($ this ->any ())
122123 ->method ('getAllActiveEvents ' )
123- ->willReturn ([ 'foo.bar ' ] );
124+ ->willReturn (array ( 'foo.bar ' ) );
124125 $ eventRegistry ->expects ($ this ->once ())
125126 ->method ('getEventClassName ' )
126127 ->with ('kernel.request ' )
127128 ->willReturn (GetResponseEvent::class);
128- $ commands ['subscriber ' ] = [
129+ $ commands ['subscriber ' ] = array (
129130 new MakeSubscriberCommand ($ generator , $ eventRegistry ),
130- [
131+ array (
131132 // subscriber name
132133 'FooBar ' ,
133134 // event name
134- 'kernel.request '
135- ] ,
136- ] ;
135+ 'kernel.request ' ,
136+ ) ,
137+ ) ;
137138
138139 $ eventRegistry2 = $ this ->createMock (EventRegistry::class);
139140 $ eventRegistry2 ->expects ($ this ->any ())
140141 ->method ('getAllActiveEvents ' )
141- ->willReturn ([] );
142+ ->willReturn (array () );
142143 $ eventRegistry2 ->expects ($ this ->once ())
143144 ->method ('getEventClassName ' )
144145 ->willReturn (null );
145- $ commands ['subscriber_unknown_event_class ' ] = [
146+ $ commands ['subscriber_unknown_event_class ' ] = array (
146147 new MakeSubscriberCommand ($ generator , $ eventRegistry2 ),
147- [
148+ array (
148149 // subscriber name
149150 'FooBar ' ,
150151 // event name
151- 'foo.unknown_event '
152- ] ,
153- ] ;
152+ 'foo.unknown_event ' ,
153+ ) ,
154+ ) ;
154155
155- $ commands ['serializer_encoder ' ] = [
156+ $ commands ['serializer_encoder ' ] = array (
156157 new MakeSerializerEncoderCommand ($ generator ),
157158 [
158159 // encoder class name
159160 'FooBarEncoder ' ,
160161 // encoder format
161162 'foobar '
162163 ]
163- ] ;
164+ ) ;
164165
165- $ commands ['twig_extension ' ] = [
166+ $ commands ['twig_extension ' ] = array (
166167 new MakeTwigExtensionCommand ($ generator ),
167- [
168+ array (
168169 // extension class name
169- 'FooBar '
170- ]
171- ] ;
170+ 'FooBar ' ,
171+ ),
172+ ) ;
172173
173- $ commands ['unit_test ' ] = [
174+ $ commands ['unit_test ' ] = array (
174175 new MakeUnitTestCommand ($ generator ),
175- [
176+ array (
176177 // class name
177- 'FooBar '
178- ]
179- ] ;
178+ 'FooBar ' ,
179+ ),
180+ ) ;
180181
181- $ commands ['validator ' ] = [
182+ $ commands ['validator ' ] = array (
182183 new MakeValidatorCommand ($ generator ),
183- [
184+ array (
184185 // validator name
185- 'FooBar '
186- ]
187- ] ;
186+ 'FooBar ' ,
187+ ),
188+ ) ;
188189
189- $ commands ['voter ' ] = [
190+ $ commands ['voter ' ] = array (
190191 new MakeVoterCommand ($ generator ),
191- [
192+ array (
192193 // voter class name
193- 'FooBar '
194- ]
195- ];
194+ 'FooBar ' ,
195+ ),
196+ );
197+
198+ $ commands ['auth_empty ' ] = array (
199+ new MakeAuthenticatorCommand ($ generator ),
200+ array (
201+ // class name
202+ 'AppCustomAuthenticator ' ,
203+ ),
204+ );
196205
197206 return $ commands ;
198207 }
@@ -204,13 +213,13 @@ private function createGenerator()
204213
205214 private function parsePHPFiles ($ output )
206215 {
207- $ files = [] ;
216+ $ files = array () ;
208217 foreach (explode ("\n" , $ output ) as $ line ) {
209218 if (false === strpos ($ line , 'created: ' )) {
210219 continue ;
211220 }
212221
213- [ , $ filename] = explode (': ' , $ line );
222+ list ( , $ filename) = explode (': ' , $ line );
214223 $ files [] = trim ($ filename );
215224 }
216225
0 commit comments