function HelpTopicDiscoveryTest::testDiscoveryExceptionProviderMismatch

Same name and namespace in other branches
  1. 8.9.x core/modules/help_topics/tests/src/Unit/HelpTopicDiscoveryTest.php \Drupal\Tests\help_topics\Unit\HelpTopicDiscoveryTest::testDiscoveryExceptionProviderMismatch()

@covers ::findAll

File

core/modules/help_topics/tests/src/Unit/HelpTopicDiscoveryTest.php, line 22

Class

HelpTopicDiscoveryTest
@coversDefaultClass \Drupal\help_topics\HelpTopicDiscovery[[api-linebreak]] @group help_topics

Namespace

Drupal\Tests\help_topics\Unit

Code

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

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