diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:47:13 +0100 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-01-15 15:47:13 +0100 |
commit | 86719c63bf47686ca55020e6b0443344de36d45a (patch) | |
tree | e985658fe7e6ae5c5f016417533a36dac4e80f50 /src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php | |
parent | 1930c19d8214c05ceefac5ac011a6b6e7e4a983d (diff) | |
parent | 78833672469f7beb0c4a195aa0a76f7ca4133057 (diff) | |
download | wallabag-86719c63bf47686ca55020e6b0443344de36d45a.tar.gz wallabag-86719c63bf47686ca55020e6b0443344de36d45a.tar.zst wallabag-86719c63bf47686ca55020e6b0443344de36d45a.zip |
Merge pull request #1583 from wallabag/v2-fix-delete
Fix `findOneByUrl` side effect in tests
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/WallabagCoreTestCase.php | 17 |
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 | } |