TwigEnvironmentTest.php

Same filename in this branch
  1. 8.9.x core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
Same filename in other branches
  1. 9 core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php
  2. 9 core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
  3. 10 core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php
  4. 10 core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php
  5. 11.x core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php
  6. 11.x core/tests/Drupal/KernelTests/Core/Theme/TwigEnvironmentTest.php

Namespace

Drupal\Tests\system\Functional\Theme

File

core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php

View source
<?php

namespace Drupal\Tests\system\Functional\Theme;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests Twig environment.
 *
 * @group Theme
 */
class TwigEnvironmentTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'twig_theme_test',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests template class loading with Twig embed.
     */
    public function testTwigEmbed() {
        $assert_session = $this->assertSession();
        // Test the Twig embed tag.
        $this->drupalGet('twig-theme-test/embed-tag');
        $assert_session->statusCodeEquals(200);
        $assert_session->responseContains('This line is from twig_theme_test/templates/twig-theme-test-embed-tag-embedded.html.twig');
    }

}

Classes

Title Deprecated Summary
TwigEnvironmentTest Tests Twig environment.

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