I am net to phpunit in Symfony 3 and I'm wondering what exactly should I follow when testing a repository. For example, I have the following repo function:
/**
* {@inheritdoc}
*/
public function findAdminRole()
{
$role = $this->repository->findOneBy(['name' => Role::ADMIN]);
if (null === $role) {
throw new NotFoundException();
}
return $role;
}
What exactly a test for this would look like? Should I test that the function findOneBy and the NotFoundException are called or to get real data values? I am kinda stuck here.
Thank you.
Aucun commentaire:
Enregistrer un commentaire