function RegistryTest::test200ThemeSuggestions

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php \Drupal\KernelTests\Core\Theme\RegistryTest::test200ThemeSuggestions()

Tests page theme suggestions for 200 responses.

File

core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php, line 198

Class

RegistryTest
Tests the behavior of the ThemeRegistry class.

Namespace

Drupal\KernelTests\Core\Theme

Code

public function test200ThemeSuggestions() : void {
  $path_matcher = $this->prophesize(PathMatcherInterface::class);
  $path_matcher->isFrontPage()
    ->willReturn(FALSE);
  \Drupal::getContainer()->set('path.matcher', $path_matcher->reveal());
  $path_current = $this->prophesize(CurrentPathStack::class);
  $path_current->getPath()
    ->willReturn('/node/123');
  \Drupal::getContainer()->set('path.current', $path_current->reveal());
  $suggestions = \Drupal::moduleHandler()->invokeAll('theme_suggestions_page', [
    [],
  ]);
  $this->assertSame([
    'page__node',
    'page__node__%',
    'page__node__123',
  ], $suggestions);
}

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