protected function HelpTopicsSyntaxTest::listDirectories in Drupal 9
Same name and namespace in other branches
- 8 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 277
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 ($lister
->getAllAvailableInfo() as $name => $info) {
// Skip obsolete modules.
if (isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) && $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::OBSOLETE) {
continue;
}
$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;
}