File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Top Open diff view settings Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Top Open diff view settings Original file line number Diff line number Diff line change @@ -183,14 +183,14 @@ instead of
183183
184184To be able to use the fully set up service container for your console tests
185185you can extend your test from
186- :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ WebTestCase `::
186+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase `::
187187
188188 use Symfony\Component\Console\Tester\CommandTester;
189189 use Symfony\Bundle\FrameworkBundle\Console\Application;
190- use Symfony\Bundle\FrameworkBundle\Test\WebTestCase ;
190+ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase ;
191191 use Acme\DemoBundle\Command\GreetCommand;
192192
193- class ListCommandTest extends WebTestCase
193+ class ListCommandTest extends KernelTestCase
194194 {
195195 public function testExecute()
196196 {
@@ -214,3 +214,12 @@ you can extend your test from
214214 // ...
215215 }
216216 }
217+
218+ .. versionadded :: 2.5
219+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ KernelTestCase ` was
220+ extracted from :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Test\\ WebTestCase `
221+ in Symfony 2.5, where WebTestCase was made to inherit from KernelTestCase.
222+ The difference being that WebTestCase makes available an instance of
223+ :class: `Symfony\\ Bundle\\ FrameworkBundle\\ Client ` via `createClient() `,
224+ while KernelTestCase makes available an instance of
225+ :class: `Symfony\\ Component\\ HttpKernel\\ KernelInterface ` via `createKernel() `.
Original file line number Diff line number Diff line change @@ -17,15 +17,15 @@ Functional Testing
1717------------------
1818
1919If you need to actually execute a query, you will need to boot the kernel
20- to get a valid connection. In this case, you'll extend the ``WebTestCase ``,
20+ to get a valid connection. In this case, you'll extend the ``KernelTestCase ``,
2121which makes all of this quite easy::
2222
2323 // src/Acme/StoreBundle/Tests/Entity/ProductRepositoryFunctionalTest.php
2424 namespace Acme\StoreBundle\Tests\Entity;
2525
26- use Symfony\Bundle\FrameworkBundle\Test\WebTestCase ;
26+ use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase ;
2727
28- class ProductRepositoryFunctionalTest extends WebTestCase
28+ class ProductRepositoryFunctionalTest extends KernelTestCase
2929 {
3030 /**
3131 * @var \Doctrine\ORM\EntityManager
@@ -37,8 +37,7 @@ which makes all of this quite easy::
3737 */
3838 public function setUp()
3939 {
40- static::$kernel = static::createKernel();
41- static::$kernel->boot();
40+ self::bootKernel();
4241 $this->em = static::$kernel->getContainer()
4342 ->get('doctrine')
4443 ->getManager()
You can’t perform that action at this time.
0 commit comments