diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-11-09 16:31:59 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2015-11-09 16:31:59 +0100 |
commit | f1eccfd63f214dcc730ab0d18a694a5465f425db (patch) | |
tree | e6cbd355f3a360e5619821fb1415ee26a01f11ce /src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php | |
parent | 4529d0f4b6b20cbbd1ccb5339a753aff7d35552b (diff) | |
parent | 53cf5106891fc64f3f66cb6b3316654a9620239c (diff) | |
download | wallabag-f1eccfd63f214dcc730ab0d18a694a5465f425db.tar.gz wallabag-f1eccfd63f214dcc730ab0d18a694a5465f425db.tar.zst wallabag-f1eccfd63f214dcc730ab0d18a694a5465f425db.zip |
Merge pull request #1500 from wallabag/v2-quote-pgsql
Fix quote strategy for reserved keyword in Postgres
Diffstat (limited to 'src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php new file mode 100644 index 00000000..8a57fea2 --- /dev/null +++ b/src/Wallabag/ApiBundle/Tests/WallabagApiTestCase.php | |||
@@ -0,0 +1,46 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ApiBundle\Tests; | ||
4 | |||
5 | use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
6 | use Symfony\Component\BrowserKit\Cookie; | ||
7 | |||
8 | abstract class WallabagApiTestCase 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 | } | ||