diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-11-26 22:22:49 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2018-11-28 22:04:55 +0100 |
commit | 8f2038e5b15c2d7342ed18381531e5eb95e86d46 (patch) | |
tree | 8b1467a45acdb5b6ecc152edbacdd980ad6463e1 /tests/Wallabag/ApiBundle/WallabagApiTestCase.php | |
parent | 1b6b77f02956a767fb3fa9825a7b97b4879f7d42 (diff) | |
download | wallabag-8f2038e5b15c2d7342ed18381531e5eb95e86d46.tar.gz wallabag-8f2038e5b15c2d7342ed18381531e5eb95e86d46.tar.zst wallabag-8f2038e5b15c2d7342ed18381531e5eb95e86d46.zip |
Fix tests
Diffstat (limited to 'tests/Wallabag/ApiBundle/WallabagApiTestCase.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/WallabagApiTestCase.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php index 0c52aea0..a0f2f889 100644 --- a/tests/Wallabag/ApiBundle/WallabagApiTestCase.php +++ b/tests/Wallabag/ApiBundle/WallabagApiTestCase.php | |||
@@ -48,4 +48,23 @@ abstract class WallabagApiTestCase extends WebTestCase | |||
48 | 48 | ||
49 | return $client; | 49 | return $client; |
50 | } | 50 | } |
51 | |||
52 | /** | ||
53 | * Return the ID for the user admin. | ||
54 | * Used because on heavy testing we don't want to re-create the database on each run. | ||
55 | * Which means "admin" user won't have id 1 all the time. | ||
56 | * | ||
57 | * @param string $username | ||
58 | * | ||
59 | * @return int | ||
60 | */ | ||
61 | public function getUserId($username = 'admin') | ||
62 | { | ||
63 | return $this->client | ||
64 | ->getContainer() | ||
65 | ->get('doctrine.orm.entity_manager') | ||
66 | ->getRepository('WallabagUserBundle:User') | ||
67 | ->findOneByUserName($username) | ||
68 | ->getId(); | ||
69 | } | ||
51 | } | 70 | } |