Skip to content

Commit 5657d5f

Browse files
committed
Use Doctrine2 module to grab entity
1 parent 9af1de6 commit 5657d5f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tests/functional.suite.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ modules:
1111
- Symfony:
1212
app_path: 'src'
1313
environment: 'tests'
14+
- Doctrine2:
15+
depends: Symfony
16+
cleanup: true
1417
- \App\Tests\Helper\Functional

tests/functional/PublicBlogPostCept.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
<?php use App\Tests\FunctionalTester;
22
$I = new FunctionalTester($scenario);
33
$I->am('Anonymous');
4+
$I->wantTo('open blog post 1 by slug and see title');
45

5-
/** @var \Doctrine\ORM\EntityManager $em */
6-
$em = $I->grabService('doctrine');
7-
/** @var \App\Repository\PostRepository $repository */
8-
$repository = $em->getRepository(\App\Entity\Post::class);
96
/** @var \App\Entity\Post $blogPost */
10-
$blogPost = $repository->find(1);
7+
$blogPost = $I->grabEntityFromRepository(\App\Entity\Post::class, ['id' => 1]);
118
$url = sprintf('/en/blog/posts/%s', $blogPost->getSlug());
129

13-
$I->wantTo('open blog post by slug and see result');
14-
1510
$I->amOnPage($url);
1611
$I->seeResponseCodeIs(200);
1712
$I->seeCurrentUrlEquals($url);

0 commit comments

Comments
 (0)