diff --git a/tests/Controller/AdminPages/AbstractAdminControllerTest.php b/tests/Controller/AdminPages/AbstractAdminControllerTest.php index 45e33c39..d78aabf4 100644 --- a/tests/Controller/AdminPages/AbstractAdminControllerTest.php +++ b/tests/Controller/AdminPages/AbstractAdminControllerTest.php @@ -36,6 +36,7 @@ use App\Entity\Attachments\AttachmentType; use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Security; /** @@ -77,6 +78,12 @@ abstract class AbstractAdminControllerTest extends WebTestCase 'PHP_AUTH_PW' => 'test', ]); + if ($read == false) { + $this->expectException(AccessDeniedException::class); + } + + $client->catchExceptions(false); + //Test read/list access by access /new overview page $crawler = $client->request('GET', static::$base_path . '/new'); $this->assertFalse($client->getResponse()->isRedirect()); @@ -97,6 +104,11 @@ abstract class AbstractAdminControllerTest extends WebTestCase 'PHP_AUTH_PW' => 'test', ]); + $client->catchExceptions(false); + if ($read == false) { + $this->expectException(AccessDeniedException::class); + } + //Test read/list access by access /new overview page $crawler = $client->request('GET', static::$base_path . '/1'); $this->assertFalse($client->getResponse()->isRedirect()); @@ -127,6 +139,11 @@ abstract class AbstractAdminControllerTest extends WebTestCase 'PHP_AUTH_PW' => 'test', ]); + $client->catchExceptions(false); + if ($delete == false) { + $this->expectException(AccessDeniedException::class); + } + //Test read/list access by access /new overview page $crawler = $client->request('DELETE', static::$base_path . '/7');