@@ -217,13 +217,21 @@ console::
217
217
218
218
use AppBundle\Command\CreateUserCommand;
219
219
use Symfony\Component\Console\Application;
220
+ // use this if you're in the Symfony Framework
221
+ //use Symfony\Bundle\FrameworkBundle\Console\Application;
220
222
use Symfony\Component\Console\Tester\CommandTester;
221
223
222
224
class CreateUserCommandTest extends \PHPUnit_Framework_TestCase
223
225
{
224
226
public function testExecute()
225
227
{
226
228
$application = new Application();
229
+
230
+ // if you're in the Symfony framework, do this instead
231
+ // extend the KernelTestCase class
232
+ // self::bootKernel();
233
+ // $application = new Application(self::$kernel);
234
+
227
235
$application->add(new CreateUserCommand());
228
236
229
237
$command = $application->find('app:create-user');
@@ -251,13 +259,6 @@ console::
251
259
You can also test a whole console application by using
252
260
:class: `Symfony\\ Component\\ Console\\ Tester\\ ApplicationTester `.
253
261
254
- .. note ::
255
-
256
- When using the Console component in a standalone project, use
257
- :class: `Symfony\\ Component\\ Console\\ Application <Symfony\\ Component\\ Console\\ Application> `
258
- instead of
259
- :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Console\\ Application <Symfony\\ Bundle\\ FrameworkBundle\\ Console\\ Application> `
260
-
261
262
To be able to use the fully set up service container for your console tests
262
263
you can extend your test from
263
264
:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase `::
0 commit comments