function FrontMatterTest::createTwigTemplate
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php \Drupal\KernelTests\Core\Theme\FrontMatterTest::createTwigTemplate()
- 11.x core/tests/Drupal/KernelTests/Core/Theme/FrontMatterTest.php \Drupal\KernelTests\Core\Theme\FrontMatterTest::createTwigTemplate()
Creates a new temporary Twig file.
Parameters
string $content: The contents of the Twig file to save.
Return value
string The absolute path to the temporary file.
2 calls to FrontMatterTest::createTwigTemplate()
- FrontMatterTest::testFrontMatter in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ FrontMatterTest.php - Test Twig template front matter.
- FrontMatterTest::testFrontMatterBroken in core/
tests/ Drupal/ KernelTests/ Core/ Theme/ FrontMatterTest.php - Tests broken front matter.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ FrontMatterTest.php, line 62
Class
- FrontMatterTest
- Tests Twig front matter support.
Namespace
Drupal\KernelTests\Core\ThemeCode
protected function createTwigTemplate(string $content = '') : string {
$file = tempnam(sys_get_temp_dir(), 'twig') . ".html.twig";
file_put_contents($file, $content);
return $file;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.