Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 14, 2024. It is now read-only.

Commit fd6480c

Browse files
Fix tests on AppVeyor
1 parent 08b2273 commit fd6480c

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/Controller/DefaultController.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet;
66
use AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\TweetRepository;
7+
use Doctrine\ORM\EntityManagerInterface;
78
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as BaseController;
89
use Symfony\Component\HttpFoundation\Cookie;
910
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -18,13 +19,21 @@ class_alias('Symfony\Bundle\FrameworkBundle\Controller\Controller', 'Symfony\Bun
1819

1920
class DefaultController extends BaseController
2021
{
22+
/** @var EntityManagerInterface */
23+
private $entityManager;
24+
2125
/** @var TweetRepository */
2226
private $tweetRepository;
2327

28+
public function __construct(EntityManagerInterface $entityManager)
29+
{
30+
$this->entityManager = $entityManager;
31+
}
32+
2433
public function indexAction(Request $request, ?int $firstTweetId): Response
2534
{
2635
/** @var TweetRepository $tweetRepository */
27-
$tweetRepository = $this->getDoctrine()
36+
$tweetRepository = $this->entityManager
2837
->getRepository(Tweet::class);
2938

3039
$this->tweetRepository = $tweetRepository;
@@ -154,7 +163,7 @@ public function deleteLessThanAction(Request $request): RedirectResponse
154163

155164
if (!is_null($lastTweetId)) {
156165
/** @var TweetRepository $tweetRepository */
157-
$tweetRepository = $this->getDoctrine()
166+
$tweetRepository = $this->entityManager
158167
->getRepository(Tweet::class);
159168

160169
$count = $tweetRepository

tests/App/config.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ parameters:
4848
twitter_token_secret: null
4949

5050
services:
51-
Acme\DataFixtures\:
52-
resource: '../DataFixtures'
53-
tags: ['doctrine.fixture.orm']
54-
5551
_defaults:
5652
autowire: true
5753
autoconfigure: true
5854

55+
AlexisLefebvre\Bundle\AsyncTweetsBundle\Controller\:
56+
resource: '../../src/Controller'
57+
58+
Acme\DataFixtures\:
59+
resource: '../DataFixtures'
60+
tags: ['doctrine.fixture.orm']
61+
5962
Acme\Features\:
6063
resource: '../../tests/Features/*'

0 commit comments

Comments
 (0)