protected function HelpTopicsSyntaxTest::listDirectories in Drupal 8
Same name and namespace in other branches
- 9 core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php \Drupal\Tests\help_topics\Functional\HelpTopicsSyntaxTest::listDirectories()
Lists the extension help topic directories of a certain type.
Parameters
string $type: The type of extension to list: module, theme, or profile.
Return value
string[] An array of all of the help topic directories for this type of extension, keyed by extension short name.
1 call to HelpTopicsSyntaxTest::listDirectories()
- HelpTopicsSyntaxTest::testHelpTopics in core/modules/ help_topics/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php 
- Tests that all Core help topics can be rendered and have good syntax.
File
- core/modules/ help_topics/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php, line 243 
Class
- HelpTopicsSyntaxTest
- Verifies that all core Help topics can be rendered and comply with standards.
Namespace
Drupal\Tests\help_topics\FunctionalCode
protected function listDirectories($type) {
  $directories = [];
  // Find the extensions of this type, even if they are not installed, but
  // excluding test ones.
  $lister = \Drupal::service('extension.list.' . $type);
  foreach (array_keys($lister
    ->getAllAvailableInfo()) as $name) {
    $path = $lister
      ->getPath($name);
    // You can tell test modules because they are in package 'Testing', but
    // test themes are only known by being found in test directories. So...
    // exclude things in test directories.
    if (strpos($path, '/tests') === FALSE && strpos($path, '/testing') === FALSE) {
      $directories[$name] = $path . '/help_topics';
    }
  }
  return $directories;
}