function ThemeHookCollectorPassTest::testCollection

Test collection.

File

core/tests/Drupal/KernelTests/Core/Hook/ThemeHookCollectorPassTest.php, line 28

Class

ThemeHookCollectorPassTest
Tests Drupal\Core\Hook\ThemeHookCollectorPass.

Namespace

Drupal\KernelTests\Core\Hook

Code

public function testCollection() : void {
  $container = new ContainerBuilder();
  $theme_filenames = [
    'oop_hook_theme' => [
      'pathname' => 'core/modules/system/tests/themes/HookCollector/oop_hook_theme/oop_hook_theme.info.yml',
    ],
  ];
  $container->setParameter('container.themes', $theme_filenames);
  $keyvalue = new KeyValueMemoryFactory();
  $container->set('keyvalue', $keyvalue);
  $container->set('cache.bootstrap', new NullBackend('bootstrap'));
  (new ThemeHookCollectorPass())->process($container);
  $themeHookData = $container->getParameter('.theme_hook_data');
  $this->assertEquals([
    'Drupal\\oop_hook_theme\\Hook\\TestHookCollectionHooks::testHookAlter',
  ], $themeHookData['theme_hook_list']['oop_hook_theme']['test_hook_alter']);
}

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