diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2018-11-29 16:41:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-29 16:41:23 +0100 |
commit | 39502b4748709948658fd236a1883b902c6fd470 (patch) | |
tree | dc7d2ecf643f9c28b75e4fdb5efc121dcafe3536 /tests/Wallabag/ApiBundle/WallabagApiTestCase.php | |
parent | b878be4cc99fd4927c70b59386cf7a57b33bb381 (diff) | |
parent | 877787e5fe6a6545105616968939949b4db81347 (diff) | |
download | wallabag-39502b4748709948658fd236a1883b902c6fd470.tar.gz wallabag-39502b4748709948658fd236a1883b902c6fd470.tar.zst wallabag-39502b4748709948658fd236a1883b902c6fd470.zip |
Merge pull request #3758 from wallabag/dropping-php5
Dropping PHP < 7.1
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 | } |