mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Dont let Webclient catch exceptions during testing of the admin pages.
This commit is contained in:
parent
fdfb099cb5
commit
93716c8583
1 changed files with 17 additions and 0 deletions
|
@ -36,6 +36,7 @@ use App\Entity\Attachments\AttachmentType;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +78,12 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
||||||
'PHP_AUTH_PW' => 'test',
|
'PHP_AUTH_PW' => 'test',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($read == false) {
|
||||||
|
$this->expectException(AccessDeniedException::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
$client->catchExceptions(false);
|
||||||
|
|
||||||
//Test read/list access by access /new overview page
|
//Test read/list access by access /new overview page
|
||||||
$crawler = $client->request('GET', static::$base_path . '/new');
|
$crawler = $client->request('GET', static::$base_path . '/new');
|
||||||
$this->assertFalse($client->getResponse()->isRedirect());
|
$this->assertFalse($client->getResponse()->isRedirect());
|
||||||
|
@ -97,6 +104,11 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
||||||
'PHP_AUTH_PW' => 'test',
|
'PHP_AUTH_PW' => 'test',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$client->catchExceptions(false);
|
||||||
|
if ($read == false) {
|
||||||
|
$this->expectException(AccessDeniedException::class);
|
||||||
|
}
|
||||||
|
|
||||||
//Test read/list access by access /new overview page
|
//Test read/list access by access /new overview page
|
||||||
$crawler = $client->request('GET', static::$base_path . '/1');
|
$crawler = $client->request('GET', static::$base_path . '/1');
|
||||||
$this->assertFalse($client->getResponse()->isRedirect());
|
$this->assertFalse($client->getResponse()->isRedirect());
|
||||||
|
@ -127,6 +139,11 @@ abstract class AbstractAdminControllerTest extends WebTestCase
|
||||||
'PHP_AUTH_PW' => 'test',
|
'PHP_AUTH_PW' => 'test',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$client->catchExceptions(false);
|
||||||
|
if ($delete == false) {
|
||||||
|
$this->expectException(AccessDeniedException::class);
|
||||||
|
}
|
||||||
|
|
||||||
//Test read/list access by access /new overview page
|
//Test read/list access by access /new overview page
|
||||||
$crawler = $client->request('DELETE', static::$base_path . '/7');
|
$crawler = $client->request('DELETE', static::$base_path . '/7');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue