function DependencyTest::testMissingRequirements
Same name and namespace in other branches
- main core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testMissingRequirements()
Tests that modules that don't pass requirement checks cannot be enabled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Module/ DependencyTest.php, line 80
Class
- DependencyTest
- Enable module without dependency enabled.
Namespace
Drupal\Tests\system\Functional\ModuleCode
public function testMissingRequirements() : void {
// Test that the system_dependencies_test module is marked
// as missing a dependency.
$this->drupalGet('admin/modules');
$this->assertSession()
->pageTextContains(Unicode::ucfirst('_missing_dependency') . ' (missing)');
$this->assertSession()
->elementTextEquals('xpath', '//tr[@data-drupal-selector="edit-modules-system-dependencies-test"]//span[@class="admin-missing"]', 'missing');
$this->assertSession()
->checkboxNotChecked('modules[system_dependencies_test][enable]');
// Test that the system_incompatible_module_version_dependencies_test is
// marked as having an incompatible dependency.
$this->assertSession()
->pageTextContains('System incompatible module version test (>2.0) (incompatible with version 1.0)');
$this->assertSession()
->elementTextEquals('xpath', '//tr[@data-drupal-selector="edit-modules-system-incompatible-module-version-dependencies-test"]//span[@class="admin-missing"]', 'incompatible with');
$this->assertSession()
->fieldDisabled('modules[system_incompatible_module_version_dependencies_test][enable]');
// Test that the system_incompatible_core_version_dependencies_test is
// marked as having an incompatible dependency.
$this->assertSession()
->pageTextContains('System core incompatible semver test (incompatible with this version of Drupal core)');
$this->assertSession()
->elementTextEquals('xpath', '//tr[@data-drupal-selector="edit-modules-system-incompatible-core-version-dependencies-test"]//span[@class="admin-missing"]', 'incompatible with');
$this->assertSession()
->fieldDisabled('modules[system_incompatible_core_version_dependencies_test][enable]');
// Test PHP version requirements.
$this->assertSession()
->pageTextContains('This module requires PHP version 6502.* and is incompatible with PHP version ' . phpversion() . '.');
$this->assertSession()
->fieldDisabled('modules[system_incompatible_php_version_test][enable]');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.