public function ThemeNegotiatorTest::testDetermineActiveTheme in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php \Drupal\Tests\Core\Theme\ThemeNegotiatorTest::testDetermineActiveTheme()
- 10 core/tests/Drupal/Tests/Core/Theme/ThemeNegotiatorTest.php \Drupal\Tests\Core\Theme\ThemeNegotiatorTest::testDetermineActiveTheme()
Tests determining the theme.
See also
\Drupal\Core\Theme\ThemeNegotiator::determineActiveTheme()
File
- core/
tests/ Drupal/ Tests/ Core/ Theme/ ThemeNegotiatorTest.php, line 61
Class
- ThemeNegotiatorTest
- @coversDefaultClass \Drupal\Core\Theme\ThemeNegotiator @group Theme
Namespace
Drupal\Tests\Core\ThemeCode
public function testDetermineActiveTheme() {
$negotiator = $this
->createMock('Drupal\\Core\\Theme\\ThemeNegotiatorInterface');
$negotiator
->expects($this
->once())
->method('determineActiveTheme')
->will($this
->returnValue('example_test'));
$negotiator
->expects($this
->once())
->method('applies')
->will($this
->returnValue(TRUE));
$this->container
->set('test_negotiator', $negotiator);
$negotiators = [
'test_negotiator',
];
$this->themeAccessCheck
->expects($this
->any())
->method('checkAccess')
->will($this
->returnValue(TRUE));
$route_match = new RouteMatch('test_route', new Route('/test-route'), [], []);
$theme = $this
->createThemeNegotiator($negotiators)
->determineActiveTheme($route_match);
$this
->assertEquals('example_test', $theme);
}