You are here

function ClassLoaderTest::testClassLoadingDisabledModules in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/ClassLoaderTest.php \Drupal\system\Tests\Module\ClassLoaderTest::testClassLoadingDisabledModules()

Tests that module-provided classes can't be loaded from disabled modules.

See also

\Drupal\module_autoload_test\SomeClass

File

core/modules/system/src/Tests/Module/ClassLoaderTest.php, line 45
Contains \Drupal\system\Tests\Module\ClassLoaderTest.

Class

ClassLoaderTest
Tests class loading for modules.

Namespace

Drupal\system\Tests\Module

Code

function testClassLoadingDisabledModules() {

  // Ensure that module_autoload_test is disabled.
  $this->container
    ->get('module_installer')
    ->uninstall(array(
    'module_autoload_test',
  ), FALSE);
  $this
    ->resetAll();

  // Check twice to test an unprimed and primed system_list() cache.
  for ($i = 0; $i < 2; $i++) {
    $this
      ->drupalGet('module-test/class-loading');
    $this
      ->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
  }
}