You are here

protected function FrontMatterTest::createTwigTemplate in Drupal 9

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\Theme

Code

protected function createTwigTemplate(string $content = '') : string {
  $file = tempnam(sys_get_temp_dir(), 'twig') . ".html.twig";
  file_put_contents($file, $content);
  return $file;
}