You are here

public function AjaxBasePageNegotiatorTest::testDetermineActiveThemeInvalidToken in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php \Drupal\Tests\Core\Theme\AjaxBasePageNegotiatorTest::testDetermineActiveThemeInvalidToken()
  2. 9 core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php \Drupal\Tests\Core\Theme\AjaxBasePageNegotiatorTest::testDetermineActiveThemeInvalidToken()

@covers ::determineActiveTheme

File

core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php, line 97

Class

AjaxBasePageNegotiatorTest
@coversDefaultClass \Drupal\Core\Theme\AjaxBasePageNegotiator @group Theme

Namespace

Drupal\Tests\Core\Theme

Code

public function testDetermineActiveThemeInvalidToken() {
  $theme = 'claro';
  $theme_token = 'invalid_theme_token';
  $request = new Request([], [
    'ajax_page_state' => [
      'theme' => $theme,
      'theme_token' => $theme_token,
    ],
  ]);
  $request->request = new InputBag($request->request
    ->all());
  $this->requestStack
    ->push($request);
  $route_match = RouteMatch::createFromRequest($request);
  $this->tokenGenerator
    ->validate($theme_token, $theme)
    ->willReturn(FALSE);
  $result = $this->negotiator
    ->determineActiveTheme($route_match);
  $this
    ->assertSame(NULL, $result);
}