You are here

protected function HelpTopicTwigLoaderTest::setUpVfs in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigLoaderTest::setUpVfs()

Sets up the virtual file system.

1 call to HelpTopicTwigLoaderTest::setUpVfs()
HelpTopicTwigLoaderTest::setUp in core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php

File

core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php, line 107

Class

HelpTopicTwigLoaderTest
Unit test for the HelpTopicTwigLoader class.

Namespace

Drupal\Tests\help_topics\Unit

Code

protected function setUpVfs() {
  $content = <<<EOF
---
label: Test
---
<h2>Test</h2>
EOF;
  $invalid_content = <<<EOF
---
foo : [bar}
---
<h2>Test</h2>
EOF;
  $help_topics_dir = [
    'help_topics' => [
      'test.topic.html.twig' => $content,
      'test.invalid_yaml.html.twig' => $invalid_content,
    ],
  ];
  vfsStream::setup('root');
  vfsStream::create([
    'modules' => [
      'test' => $help_topics_dir,
    ],
    'themes' => [
      'test' => $help_topics_dir,
    ],
  ]);
  $this->directories = [
    'root' => vfsStream::url('root'),
    'module' => [
      'test' => vfsStream::url('root/modules/test'),
      'not_a_dir' => vfsStream::url('root/modules/not_a_dir'),
    ],
    'theme' => [
      'test' => vfsStream::url('root/themes/test'),
      'not_a_dir' => vfsStream::url('root/themes/not_a_dir'),
    ],
  ];
}