diff options
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..fd2e113e 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 | protected 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 | } |