function HelpTopicDiscoveryTest::testDiscoveryExceptionMissingLabel

Tests discovery exception missing label.

@legacy-covers ::findAll

File

core/modules/help/tests/src/Unit/HelpTopicDiscoveryTest.php, line 29

Class

HelpTopicDiscoveryTest
Tests Drupal\help\HelpTopicDiscovery.

Namespace

Drupal\Tests\help\Unit

Code

public function testDiscoveryExceptionMissingLabel() : void {
  vfsStream::setup('root');
  vfsStream::create([
    'modules' => [
      'test' => [
        'help_topics' => [
          // The content of the help topic does not matter.
'test.topic.html.twig' => '',
        ],
      ],
    ],
  ]);
  $discovery = new HelpTopicDiscovery([
    'test' => vfsStream::url('root/modules/test/help_topics'),
  ]);
  $this->expectException(DiscoveryException::class);
  $this->expectExceptionMessage("vfs://root/modules/test/help_topics/test.topic.html.twig does not contain the required key with name='label'");
  $discovery->getDefinitions();
}

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