Skip to content

Commit

Permalink
[Console] Focus on framework users first in the guides
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Aug 21, 2016
1 parent cf4022e commit 8e66547
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,16 @@ console::
namespace Tests\AppBundle\Command;

use AppBundle\Command\CreateUserCommand;
use Symfony\Component\Console\Application;
// use this if you're in the Symfony Framework
//use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

class CreateUserCommandTest extends \PHPUnit_Framework_TestCase
class CreateUserCommandTest extends KernelTestCase
{
public function testExecute()
{
$application = new Application();

// if you're in the Symfony framework, do this instead
// extend the KernelTestCase class
// self::bootKernel();
// $application = new Application(self::$kernel);
self::bootKernel();
$application = new Application(self::$kernel);

$application->add(new CreateUserCommand());

Expand Down Expand Up @@ -259,6 +254,12 @@ console::
You can also test a whole console application by using
:class:`Symfony\\Component\\Console\\Tester\\ApplicationTester`.

.. note::

When using the Console component in a standalone project, use
:class:`Symfony\\Component\\Console\\Application <Symfony\\Component\\Console\\Application>`
and extend the normal ``\PHPUnit_Framework_TestCase``.

To be able to use the fully set up service container for your console tests
you can extend your test from
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`::
Expand Down

0 comments on commit 8e66547

Please sign in to comment.