function ViewsTemplateTest::testThemeSuggestionsContainerAlter

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/ViewsTemplateTest.php \Drupal\Tests\views\Kernel\ViewsTemplateTest::testThemeSuggestionsContainerAlter()
  2. 11.x core/modules/views/tests/src/Kernel/ViewsTemplateTest.php \Drupal\Tests\views\Kernel\ViewsTemplateTest::testThemeSuggestionsContainerAlter()

@covers views_theme_suggestions_container_alter

Throws

\Exception

File

core/modules/views/tests/src/Kernel/ViewsTemplateTest.php, line 51

Class

ViewsTemplateTest
Tests the template retrieval of views.

Namespace

Drupal\Tests\views\Kernel

Code

public function testThemeSuggestionsContainerAlter() : void {
    $build = [
        '#type' => 'view',
        '#name' => 'test_page_display',
        '#display_id' => 'default',
        '#arguments' => [],
    ];
    $output = $this->render($build);
    $extension = '.html.twig';
    $expected = '<!-- FILE NAME SUGGESTIONS:' . PHP_EOL . '   ▪️ container--more-link--test-page-display--default' . $extension . PHP_EOL . '   ▪️ container--more-link--default' . $extension . PHP_EOL . '   ▪️ container--more-link--test-page-display' . $extension . PHP_EOL . '   ▪️ container--more-link' . $extension . PHP_EOL . '   ✅ container' . $extension . PHP_EOL . '-->' . PHP_EOL;
    $this->assertStringContainsString($expected, $output, 'Views more link container suggestions found in Twig debug output');
}

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