Skip to content
Snippets Groups Projects
Commit bd6b92d8 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2777651 by mkalkbrenner: Add coverage for uninstalled modules in...

Issue #2777651 by mkalkbrenner: Add coverage for uninstalled modules in Drupal\system\Tests\Module\ClassLoaderTest class loading tests
parent 850b9eeb
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -28,22 +28,44 @@ function testClassLoading() {
// Check twice to test an unprimed and primed system_list() cache.
for ($i = 0; $i < 2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertResponse(200);
$this->assertText($this->expected, 'Autoloader loads classes from an enabled module.');
}
}
/**
* Tests that module-provided classes can't be loaded if module not installed.
*
* @see \Drupal\module_autoload_test\SomeClass
*/
function testClassLoadingNotInstalledModules() {
// Enable the module_test module.
\Drupal::service('module_installer')->install(array('module_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->assertResponse(200);
$this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
}
}
/**
* Tests that module-provided classes can't be loaded from disabled modules.
*
* @see \Drupal\module_autoload_test\SomeClass
*/
function testClassLoadingDisabledModules() {
// Enable the module_test and module_autoload_test modules.
\Drupal::service('module_installer')->install(array('module_test', 'module_autoload_test'), FALSE);
$this->resetAll();
// 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->assertResponse(200);
$this->assertNoText($this->expected, 'Autoloader does not load classes from a disabled module.');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment