forked from wallabag/wallabag
Fix tests
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user