Fix tests

This commit is contained in:
Jeremy Benoist
2018-11-26 22:22:49 +01:00
parent 1b6b77f029
commit 8f2038e5b1
5 changed files with 86 additions and 71 deletions

View File

@ -48,4 +48,23 @@ abstract class WallabagApiTestCase extends WebTestCase
return $client;
}
/**
* Return the ID for the user admin.
* Used because on heavy testing we don't want to re-create the database on each run.
* Which means "admin" user won't have id 1 all the time.
*
* @param string $username
*
* @return int
*/
public function getUserId($username = 'admin')
{
return $this->client
->getContainer()
->get('doctrine.orm.entity_manager')
->getRepository('WallabagUserBundle:User')
->findOneByUserName($username)
->getId();
}
}