function TwigEnvironmentTest::testTwigEmbed

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php \Drupal\Tests\system\Functional\Theme\TwigEnvironmentTest::testTwigEmbed()
  2. 10 core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php \Drupal\Tests\system\Functional\Theme\TwigEnvironmentTest::testTwigEmbed()
  3. 11.x core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php \Drupal\Tests\system\Functional\Theme\TwigEnvironmentTest::testTwigEmbed()

Tests template class loading with Twig embed.

File

core/modules/system/tests/src/Functional/Theme/TwigEnvironmentTest.php, line 27

Class

TwigEnvironmentTest
Tests Twig environment.

Namespace

Drupal\Tests\system\Functional\Theme

Code

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');
}

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