function ClassLoaderTest::testAutoloadFromModuleFile
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php \Drupal\Tests\system\Functional\Module\ClassLoaderTest::testAutoloadFromModuleFile()
- 8.9.x core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php \Drupal\Tests\system\Functional\Module\ClassLoaderTest::testAutoloadFromModuleFile()
- 10 core/modules/system/tests/src/Functional/Module/ClassLoaderTest.php \Drupal\Tests\system\Functional\Module\ClassLoaderTest::testAutoloadFromModuleFile()
Tests that .module files can use class constants in main section.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ ClassLoaderTest.php, line 107
Class
- ClassLoaderTest
- Tests class loading for modules.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testAutoloadFromModuleFile() : void {
$this->assertFalse(defined('MODULE_AUTOLOAD_TEST_CONSTANT'));
// Create use with required permissions.
$this->drupalLogin($this->drupalCreateUser([
'administer modules',
]));
$edit = [
"modules[module_autoload_test][enable]" => TRUE,
];
$this->drupalGet('admin/modules');
$this->submitForm($edit, 'Install');
$this->assertSession()
->statusCodeEquals(200);
$this->resetAll();
$this->assertSame(SomeClass::TEST, MODULE_AUTOLOAD_TEST_CONSTANT);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.