You are here

function ModuleHandlerTest::testModuleImplements in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/service_container/Tests/ModuleHandlerTest.php \Drupal\service_container\Tests\ModuleHandlerTest::testModuleImplements()

Test module_implements() caching.

File

lib/Drupal/service_container/Tests/ModuleHandlerTest.php, line 87
Contains \Drupal\service_container\Tests\ModuleHandlerTest.

Class

ModuleHandlerTest
Tests the module_handler implementation of the service_container.

Namespace

Drupal\service_container\Tests

Code

function testModuleImplements() {

  // Make sure group include files are detected properly even when the file is
  // already loaded when the cache is rebuilt.
  // For that activate the module_test which provides the file to load.
  $this
    ->moduleInstaller()
    ->install(array(
    'module_test',
  ));
  $this
    ->moduleHandler()
    ->loadInclude('module_test', 'inc', 'module_test.file');
  $modules = $this
    ->moduleHandler()
    ->getImplementations('test_hook');
  $this
    ->assertTrue(in_array('module_test', $modules), 'Hook found.');
}