aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-01-15 15:28:22 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-15 15:28:32 +0100
commit78833672469f7beb0c4a195aa0a76f7ca4133057 (patch)
tree87e295afbfc22e94262f3c498ce758a1101c939e /src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php
parent790573d45899504bdecd2573c8f64018e23b139e (diff)
downloadwallabag-78833672469f7beb0c4a195aa0a76f7ca4133057.tar.gz
wallabag-78833672469f7beb0c4a195aa0a76f7ca4133057.tar.zst
wallabag-78833672469f7beb0c4a195aa0a76f7ca4133057.zip
Fix `findOneByUrl` side effect in tests
Fix #1566
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php
index ce3cabe8..c4905478 100644
--- a/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php
+++ b/src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php
@@ -31,4 +31,21 @@ abstract class WallabagCoreTestCase extends WebTestCase
31 31
32 $this->client->submit($form, $data); 32 $this->client->submit($form, $data);
33 } 33 }
34
35 /**
36 * Return the user id of the logged in user.
37 * You should be sure that you called `logInAs` before.
38 *
39 * @return int
40 */
41 public function getLoggedInUserId()
42 {
43 $token = static::$kernel->getContainer()->get('security.token_storage')->getToken();
44
45 if (null !== $token) {
46 return $token->getUser()->getId();
47 }
48
49 throw new \RuntimeException('No logged in User.');
50 }
34} 51}