aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-11-01 23:42:52 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-11-07 14:16:13 +0100
commit8a493541fa4911233fe9186e88371d17cb9fd7db (patch)
treecd4011716fbf85b29b54d33e0ca17920cb5fe6d4 /src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
parent735068d1814a4b7a688e1d19cd17b13e8c5da3eb (diff)
downloadwallabag-8a493541fa4911233fe9186e88371d17cb9fd7db.tar.gz
wallabag-8a493541fa4911233fe9186e88371d17cb9fd7db.tar.zst
wallabag-8a493541fa4911233fe9186e88371d17cb9fd7db.zip
Re-enable test on doctrine command
It will slow down the whole test suite (because it'll use doctrine command). Remove unecessary `KernelTestCase`. Also rename `AbstractControllerTest` to `WallabagApiTestCase` for consistency.
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php')
-rw-r--r--src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
deleted file mode 100644
index 09cde0f6..00000000
--- a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
1<?php
2
3namespace Wallabag\ApiBundle\Tests;
4
5use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6use Symfony\Component\BrowserKit\Cookie;
7
8abstract class AbstractControllerTest extends WebTestCase
9{
10 /**
11 * @var Client
12 */
13 protected $client = null;
14
15 public function setUp()
16 {
17 $this->client = $this->createAuthorizedClient();
18 }
19
20 /**
21 * @return Client
22 */
23 protected function createAuthorizedClient()
24 {
25 $client = static::createClient();
26 $container = $client->getContainer();
27
28 /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */
29 $userManager = $container->get('fos_user.user_manager');
30 /** @var $loginManager \FOS\UserBundle\Security\LoginManager */
31 $loginManager = $container->get('fos_user.security.login_manager');
32 $firewallName = $container->getParameter('fos_user.firewall_name');
33
34 $user = $userManager->findUserBy(array('username' => 'admin'));
35 $loginManager->loginUser($firewallName, $user);
36
37 // save the login token into the session and put it in a cookie
38 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
39 $container->get('session')->save();
40
41 $session = $container->get('session');
42 $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
43
44 return $client;
45 }
46}