function EngineTwigTest::testTwigFileUrls

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

Tests the automatic/magic calling of toString() on objects, if exists.

File

core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php, line 137

Class

EngineTwigTest
Tests Twig-specific theme functionality.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testTwigFileUrls() : void {
    $this->drupalGet('/twig-theme-test/file-url');
    
    /** @var \Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator */
    $file_url_generator = \Drupal::service('file_url_generator');
    $filepath = $file_url_generator->generateString('core/modules/system/tests/modules/twig_theme_test/js/twig_theme_test.js');
    $this->assertSession()
        ->responseContains('<div>file_url: ' . $filepath . '</div>');
}

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