Replaces $this->method() with self::method(). Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
35 lines
1011 B
PHP
35 lines
1011 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 = self::createStub(ServerRequest::class);
|
|
$request->method('isPost')->willReturn(true);
|
|
|
|
$authPlugin = self::createMock(AuthenticationPlugin::class);
|
|
$authPlugin->expects(self::once())->method('logOut');
|
|
|
|
$factory = self::createStub(AuthenticationPluginFactory::class);
|
|
$factory->method('create')->willReturn($authPlugin);
|
|
|
|
(new LogoutController($factory))($request);
|
|
|
|
unset($GLOBALS['token_mismatch']);
|
|
}
|
|
}
|