diff --git a/core/modules/system/src/Tests/Theme/EngineTwigTest.php b/core/modules/system/src/Tests/Theme/EngineTwigTest.php index c03f16b..39ef521 100644 --- a/core/modules/system/src/Tests/Theme/EngineTwigTest.php +++ b/core/modules/system/src/Tests/Theme/EngineTwigTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Theme; +use Drupal\Core\Url; use Drupal\simpletest\WebTestBase; /** @@ -63,4 +64,24 @@ public function testTwigUrlGenerator() { } } + /** + * Tests the link_generator twig functions. + */ + public function testTwigLinkGenerator() { + $this->drupalGet('twig-theme-test/link-generator'); + + $link_generator = $this->container->get('link_generator'); + + $expected = [ + 'link via the linkgenerator: ' . $link_generator->generateFromUrl('register', new Url('user.register')), + ]; + + $content = $this->drupalGetContent(); + debug($content); + $this->assertFalse(empty($content), 'Page content is not empty'); + foreach ($expected as $string) { + $this->assertRaw('
' . $string . '
'); + } + } + } diff --git a/core/modules/system/templates/menu.html.twig b/core/modules/system/templates/menu.html.twig index 3151454..528f9d7 100644 --- a/core/modules/system/templates/menu.html.twig +++ b/core/modules/system/templates/menu.html.twig @@ -26,11 +26,11 @@ {% macro menu_links(items, menu_level) %} {% import _self as menus %} {% if items %} - {% if menu_level is 0 %} -