class HookCollectorPassTest
Same name in this branch
- 11.x core/tests/Drupal/Tests/Core/Hook/HookCollectorPassTest.php \Drupal\Tests\Core\Hook\HookCollectorPassTest
@coversDefaultClass \Drupal\Core\Hook\HookCollectorPass @group Hook
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait
- class \Drupal\KernelTests\Core\Hook\HookCollectorPassTest extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of HookCollectorPassTest
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Hook/ HookCollectorPassTest.php, line 15
Namespace
Drupal\KernelTests\Core\HookView source
class HookCollectorPassTest extends KernelTestBase {
/**
* VFS does not and can not support symlinks.
*/
protected function setUpFilesystem() : void {
}
/**
* Test that symlinks are properly followed.
*/
public function testSymlink() : void {
mkdir($this->siteDirectory);
foreach (scandir("core/modules/user/tests/modules/user_hooks_test") as $item) {
$target = "{$this->siteDirectory}/{$item}";
if (!file_exists($target)) {
symlink(realpath("core/modules/user/tests/modules/user_hooks_test/{$item}"), $target);
}
}
$container = new ContainerBuilder();
$module_filenames = [
'user_hooks_test' => [
'pathname' => "{$this->siteDirectory}/user_hooks_test.info.yml",
],
];
$container->setParameter('container.modules', $module_filenames);
(new HookCollectorPass())->process($container);
$implementations = [
'user_format_name_alter' => [
'Drupal\\user_hooks_test\\Hook\\UserHooksTest' => [
'userFormatNameAlter' => 'user_hooks_test',
],
],
];
$this->assertSame($implementations, $container->getParameter('hook_implementations_map'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.