function TwigAllowListTest::testAllowListChaining
Tests listing of methods doesn't interfere with chaining.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ TwigAllowListTest.php, line 124
Class
- TwigAllowListTest
- Tests the allowed list of entity properties.
Namespace
Drupal\KernelTests\Core\ThemeCode
public function testAllowListChaining() : void {
/** @var \Drupal\Core\Template\TwigEnvironment $environment */
$environment = \Drupal::service('twig');
$node = Node::create([
'type' => 'page',
'title' => 'Some node mmk',
'status' => 1,
'field_term' => $this->term
->id(),
]);
$node->save();
$template = $environment->load($this->getThemePath('test_theme') . '/templates/node.html.twig');
$markup = $template->render([
'node' => $node,
]);
$this->setRawContent($markup);
$this->assertText('Sometimes people are just jerks');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.