phpmyadmin/test/classes/Controllers/LogoutControllerTest.php
Maurício Meneghini Fauth 3f2c53ef1d
Replace PHPUnit annotations with attributes
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-06-07 11:44:01 -03:00

35 lines
1015 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Tests\Controllers;
use PhpMyAdmin\Controllers\LogoutController;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Plugins\AuthenticationPlugin;
use PhpMyAdmin\Plugins\AuthenticationPluginFactory;
use PhpMyAdmin\Tests\AbstractTestCase;
use PHPUnit\Framework\Attributes\CoversClass;
#[CoversClass(LogoutController::class)]
class LogoutControllerTest extends AbstractTestCase
{
public function testValidLogout(): void
{
$GLOBALS['token_mismatch'] = false;
$request = $this->createStub(ServerRequest::class);
$request->method('isPost')->willReturn(true);
$authPlugin = $this->createMock(AuthenticationPlugin::class);
$authPlugin->expects($this->once())->method('logOut');
$factory = $this->createStub(AuthenticationPluginFactory::class);
$factory->method('create')->willReturn($authPlugin);
(new LogoutController($factory))($request);
unset($GLOBALS['token_mismatch']);
}
}