Working state
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Tests\User;
|
||||
|
||||
use App\Shared\Http\FlashServiceInterface;
|
||||
use App\Shared\Http\SessionManagerInterface;
|
||||
use App\Shared\Pagination\PaginatedResult;
|
||||
use App\User\Exception\DuplicateEmailException;
|
||||
use App\User\Exception\DuplicateUsernameException;
|
||||
use App\User\Exception\WeakPasswordException;
|
||||
@@ -12,7 +13,7 @@ use App\User\User;
|
||||
use App\User\UserController;
|
||||
use App\User\UserServiceInterface;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Tests\ControllerTestCase;
|
||||
use Tests\ControllerTestBase;
|
||||
|
||||
/**
|
||||
* Tests unitaires pour UserController.
|
||||
@@ -25,7 +26,7 @@ use Tests\ControllerTestCase;
|
||||
* - delete() : introuvable, cible admin, soi-même, succès
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations]
|
||||
final class UserControllerTest extends ControllerTestCase
|
||||
final class UserControllerTest extends ControllerTestBase
|
||||
{
|
||||
/** @var \Slim\Views\Twig&MockObject */
|
||||
private \Slim\Views\Twig $view;
|
||||
@@ -63,7 +64,7 @@ final class UserControllerTest extends ControllerTestCase
|
||||
*/
|
||||
public function testIndexRendersWithUserList(): void
|
||||
{
|
||||
$this->userService->method('findAll')->willReturn([]);
|
||||
$this->userService->method('findPaginated')->willReturn(new PaginatedResult([], 0, 1, 20));
|
||||
$this->sessionManager->method('getUserId')->willReturn(1);
|
||||
|
||||
$this->view->expects($this->once())
|
||||
|
||||
@@ -235,7 +235,7 @@ final class UserServiceTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* updateRole() accepte les trois rôles valides sans lever d'exception.
|
||||
* updateRole() accepte uniquement les rôles attribuables depuis l'interface.
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\DataProvider('validRolesProvider')]
|
||||
public function testUpdateRoleAcceptsAllValidRoles(string $role): void
|
||||
@@ -254,7 +254,6 @@ final class UserServiceTest extends TestCase
|
||||
return [
|
||||
'user' => [User::ROLE_USER],
|
||||
'editor' => [User::ROLE_EDITOR],
|
||||
'admin' => [User::ROLE_ADMIN],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user