You are here

public function EngineTwigTest::testTwigUrlToString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/EngineTwigTest.php \Drupal\system\Tests\Theme\EngineTwigTest::testTwigUrlToString()

Tests the magic url to string Twig functions.

See also

\Drupal\Core\Url

File

core/modules/system/src/Tests/Theme/EngineTwigTest.php, line 109
Contains \Drupal\system\Tests\Theme\EngineTwigTest.

Class

EngineTwigTest
Tests Twig-specific theme functionality.

Namespace

Drupal\system\Tests\Theme

Code

public function testTwigUrlToString() {
  $this
    ->drupalGet('twig-theme-test/url-to-string');
  $expected = [
    'rendered url: ' . Url::fromRoute('user.register')
      ->toString(),
  ];
  $content = $this
    ->getRawContent();
  $this
    ->assertFalse(empty($content), 'Page content is not empty');
  foreach ($expected as $string) {
    $this
      ->assertRaw('<div>' . $string . '</div>');
  }
}