function AjaxBasePageNegotiatorTest::testDetermineActiveThemeDefaultTheme

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php \Drupal\Tests\Core\Theme\AjaxBasePageNegotiatorTest::testDetermineActiveThemeDefaultTheme()
  2. 10 core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php \Drupal\Tests\Core\Theme\AjaxBasePageNegotiatorTest::testDetermineActiveThemeDefaultTheme()
  3. 11.x core/tests/Drupal/Tests/Core/Theme/AjaxBasePageNegotiatorTest.php \Drupal\Tests\Core\Theme\AjaxBasePageNegotiatorTest::testDetermineActiveThemeDefaultTheme()

@covers ::determineActiveTheme

File

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

Class

AjaxBasePageNegotiatorTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Theme%21AjaxBasePageNegotiator.php/class/AjaxBasePageNegotiator/9" title="Defines a theme negotiator that deals with the active theme on ajax requests." class="local">\Drupal\Core\Theme\AjaxBasePageNegotiator</a> @group Theme

Namespace

Drupal\Tests\Core\Theme

Code

public function testDetermineActiveThemeDefaultTheme() {
    $theme = 'stark';
    // When the theme is the system default, an empty string is provided as the
    // theme token. See system_js_settings_alter().
    $theme_token = '';
    $request = new Request([], [
        'ajax_page_state' => [
            'theme' => $theme,
            'theme_token' => $theme_token,
        ],
    ]);
    $this->requestStack
        ->push($request);
    $route_match = RouteMatch::createFromRequest($request);
    $this->tokenGenerator
        ->validate(Argument::cetera())
        ->shouldNotBeCalled();
    $result = $this->negotiator
        ->determineActiveTheme($route_match);
    $this->assertSame($theme, $result);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.