Skip to content

Commit 737d769

Browse files
committed
updated
1 parent 4e234c8 commit 737d769

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

_posts/2015-09-04-using-codeception-for-symfony-projects.markdown

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ Unit tests of Codeception are not quite different from regular PHPUnit tests. Yo
6161
Let's have a test that will check that there is specific number of posts on a page. Symfony-demo app has the [similar test](https://github.com/symfony/symfony-demo/blob/master/src%2FAppBundle%2FTests%2FController%2FBlogControllerTest.php#L29) included:
6262

6363
{% highlight php %}
64+
<?php
65+
namespace AppBundle\Tests\Controller;
66+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6467
use AppBundle\Entity\Post;
68+
6569
class BlogControllerTest extends WebTestCase
6670
{
6771
public function testIndex()
@@ -87,7 +91,10 @@ php bin/codecept g:cest functional BlogCest -c src/AppBundle
8791
And here goes the test:
8892

8993
{% highlight php %}
94+
<?php
95+
namespace AppBundle;
9096
use AppBundle\Entity\Post;
97+
9198
class BlogCest
9299
{
93100
public function postsOnIndexPage(FunctionalTester $I)
@@ -161,7 +168,7 @@ you will probably see that `BlogCest` of `AppBundle` was executed as it was expe
161168

162169
![tests](https://github.com/Codeception/symfony-demo/raw/2.1/app/data/demo.png)
163170

164-
The most complex thing in starting using Codeception with Symfony is have it configured. Despite Codeception is auto-connecting to Symfony framework and Doctrine you still have to do some changes to follow Symfony structure. Please take a detailed look into [forked version of symfony-demo project](https://github.com/Codeception/symfony-demo)
171+
The most complex thing in starting using Codeception with Symfony is have it configured. Despite Codeception is auto-connecting to Symfony framework and Doctrine you still have to do some changes to follow Symfony structure. Please **take a detailed look into [our forked version of symfony-demo project](https://github.com/Codeception/symfony-demo)**
165172
which we configured in the manner we described in this post. Please use similar configuration for all your Symfony projects.
166173

167174
Start using Codeception and discover how complex things can be tested in really simple manner. And once again, even functional and integration tests are really fast, as we start transaction before each test and rollback it afterwards. Write them as many as you need to, do not rely on unit tests only!

0 commit comments

Comments
 (0)