function AjaxBasePageNegotiatorTest::testApplies

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

@covers ::applies @dataProvider providerTestApplies

File

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

Class

AjaxBasePageNegotiatorTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Theme%21AjaxBasePageNegotiator.php/class/AjaxBasePageNegotiator/11.x" 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 testApplies($request_data, $expected) : void {
    $request = new Request();
    foreach ($request_data as $key => $data) {
        $request->query
            ->set($key, $data);
    }
    $route_match = RouteMatch::createFromRequest($request);
    $this->requestStack
        ->push($request);
    $result = $this->negotiator
        ->applies($route_match);
    $this->assertSame($expected, $result);
}

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