function HelpTopicTwigLoaderTest::setUpVfs

Same name in other branches
  1. 9 core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigLoaderTest::setUpVfs()
  2. 8.9.x core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help_topics\Unit\HelpTopicTwigLoaderTest::setUpVfs()
  3. 10 core/modules/help/tests/src/Unit/HelpTopicTwigLoaderTest.php \Drupal\Tests\help\Unit\HelpTopicTwigLoaderTest::setUpVfs()

Sets up the virtual file system.

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

File

core/modules/help/tests/src/Unit/HelpTopicTwigLoaderTest.php, line 91

Class

HelpTopicTwigLoaderTest
Unit test for the HelpTopicTwigLoader class.

Namespace

Drupal\Tests\help\Unit

Code

protected function setUpVfs() : void {
    $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'),
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.