@@ -217,13 +217,21 @@ console::
217217
218218 use AppBundle\Command\CreateUserCommand;
219219 use Symfony\Component\Console\Application;
220+ // use this if you're in the Symfony Framework
221+ //use Symfony\Bundle\FrameworkBundle\Console\Application;
220222 use Symfony\Component\Console\Tester\CommandTester;
221223
222224 class CreateUserCommandTest extends \PHPUnit_Framework_TestCase
223225 {
224226 public function testExecute()
225227 {
226228 $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+
227235 $application->add(new CreateUserCommand());
228236
229237 $command = $application->find('app:create-user');
@@ -251,13 +259,6 @@ console::
251259 You can also test a whole console application by using
252260 :class: `Symfony\\ Component\\ Console\\ Tester\\ ApplicationTester `.
253261
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-
261262To be able to use the fully set up service container for your console tests
262263you can extend your test from
263264:class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase `::
0 commit comments