function HookCollectorPassTest::testHookIgnoreNonOop

Tests that legacy install/update hooks are ignored.

File

core/tests/Drupal/KernelTests/Core/Hook/HookCollectorPassTest.php, line 292

Class

HookCollectorPassTest
Tests Drupal\Core\Hook\HookCollectorPass.

Namespace

Drupal\KernelTests\Core\Hook

Code

public function testHookIgnoreNonOop() : void {
  $module_installer = $this->container
    ->get('module_installer');
  $this->assertTrue($module_installer->install([
    'system_module_test',
    'update',
    'update_test_2',
  ]));
  $map = $this->container
    ->get('keyvalue')
    ->get('hook_data')
    ->get('hook_list');
  $this->assertArrayHasKey('help', $map);
  // Ensure that no install or update hooks are registered in the
  // implementations map, including update functions incorrectly mapped to
  // the wrong module.
  $this->assertArrayNotHasKey('install', $map);
  $this->assertArrayNotHasKey('update_dependencies', $map);
  $this->assertArrayNotHasKey('test_2_update_8001', $map);
  $this->assertArrayNotHasKey('update_8001', $map);
}

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