mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-16 05:14:35 +02:00
Fixed UserCheckerTest
This commit is contained in:
parent
df11f62a2f
commit
5229f2fc28
2 changed files with 6 additions and 130 deletions
|
@ -45,15 +45,18 @@ namespace App\Tests\Security;
|
|||
use App\Entity\UserSystem\User;
|
||||
use App\Security\UserChecker;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
||||
use Symfony\Component\Security\Core\Exception\DisabledException;
|
||||
|
||||
class UserCheckerTest extends TestCase
|
||||
class UserCheckerTest extends WebTestCase
|
||||
{
|
||||
protected $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->service = new UserChecker();
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(UserChecker::class);
|
||||
}
|
||||
|
||||
public function testThrowDisabledException(): void
|
||||
|
@ -66,7 +69,7 @@ class UserCheckerTest extends TestCase
|
|||
|
||||
//An disabled user must throw an exception
|
||||
$user->setDisabled(true);
|
||||
$this->expectException(DisabledException::class);
|
||||
$this->expectException(CustomUserMessageAccountStatusException::class);
|
||||
$this->service->checkPostAuth($user);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue