public function ClassLoaderTest::testClassLoadingDisabledModules in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php \Drupal\Tests\system\Functional\Module\ClassLoaderTest::testClassLoadingDisabledModules()
- 9 core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php \Drupal\Tests\system\Functional\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/ tests/ src/ Functional/ Module/ ClassLoaderTest.php, line 71
Class
- ClassLoaderTest
- Tests class loading for modules.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testClassLoadingDisabledModules() {
// Enable the module_test and module_autoload_test modules.
\Drupal::service('module_installer')
->install([
'module_test',
'module_autoload_test',
], FALSE);
$this
->resetAll();
// Ensure that module_autoload_test is disabled.
$this->container
->get('module_installer')
->uninstall([
'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
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextNotContains($this->expected);
}
}