@@ -165
8000
,6 +165,54 @@ public function testRunOnlyWarnsOnUnregistrableCommand()
165
165
$ this ->assertContains ('fine ' , $ output );
166
166
}
167
167
168
+ public function testRunOnlyWarnsOnUnregistrableCommandAtTheEnd ()
169
+ {
170
+ $ container = new ContainerBuilder ();
171
+ $ container ->register ('event_dispatcher ' , EventDispatcher::class);
172
+ $ container ->register (ThrowingCommand::class, ThrowingCommand::class);
173
+ $ container ->setParameter ('console.command.ids ' , array (ThrowingCommand::class => ThrowingCommand::class));
174
+
175
+ $ kernel = $ this ->getMockBuilder (KernelInterface::class)->getMock ();
176
+ $ kernel
177
+ ->method ('getBundles ' )
178
+ ->willReturn (array ($ this ->createBundleMock (
179
+ array ((new Command ('fine ' ))->setCode (function (InputInterface $ input , OutputInterface $ output ) { $ output ->write ('fine ' ); }))
180
+ )));
181
+ $ kernel
182
+ ->method ('getContainer ' )
183
+ ->willReturn ($ container );
184
+
185
+ $ application = new Application ($ kernel );
186
+ $ application ->setAutoExit (false );
187
+
188
+ $ tester = new ApplicationTester ($ application );
189
+ $ tester ->run (array ('command ' => 'list ' ));
190
+
191
+ $ this ->assertSame (0 , $ tester ->getStatusCode ());
192
+ $ this ->assertContains (trim ('
193
+ Usage:
194
+ command [options] [arguments]
195
+
196
+ Options:
197
+ -h, --help Display this help message
198
+ -q, --quiet Do not output any message
199
+ -V, --version Display this application version
200
+ --ansi Force ANSI output
201
+ --no-ansi Disable ANSI output
202
+ -n, --no-interaction Do not ask any interactive question
203
+ -e, --env=ENV The Environment name.
204
+ --no-debug Switches off debug mode.
205
+ -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
206
+
207
+ Available commands:
208
+ fine
209
+ help Displays help for a command
210
+ list Lists commands
211
+
212
+ [WARNING] Some commands could not be registered:
213
+ ' ), trim ($ tester ->getDisplay ()));
214
+ }
215
+
168
216
private function getKernel (array $ bundles , $ useDispatcher = false )
169
217
{
170
218
$ container = $ this ->getMockBuilder ('Symfony\Component\DependencyInjection\ContainerInterface ' )->getMock ();
0 commit comments