function DependencyTest::testCoreCompatibility

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testCoreCompatibility()
  2. 8.9.x core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testCoreCompatibility()
  3. 10 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testCoreCompatibility()

Tests enabling modules with different core version specifications.

File

core/modules/system/tests/src/Functional/Module/DependencyTest.php, line 175

Class

DependencyTest
Enable module without dependency enabled.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testCoreCompatibility() : void {
    $this->markTestSkipped('Skipped due to major version-specific logic. See https://www.drupal.org/project/drupal/issues/3359322');
    $assert_session = $this->assertSession();
    // Test incompatible 'core_version_requirement'.
    $this->drupalGet('admin/modules');
    $assert_session->fieldDisabled('modules[system_core_incompatible_semver_test][enable]');
    // Test compatible 'core_version_requirement' and compatible 'core'.
    $this->drupalGet('admin/modules');
    $assert_session->fieldEnabled('modules[common_test][enable]');
    $assert_session->fieldEnabled('modules[system_core_semver_test][enable]');
    // Ensure the modules can actually be installed.
    $edit['modules[common_test][enable]'] = 'common_test';
    $edit['modules[system_core_semver_test][enable]'] = 'system_core_semver_test';
    $this->drupalGet('admin/modules');
    $this->submitForm($edit, 'Install');
    $this->assertModules([
        'common_test',
        'system_core_semver_test',
    ], TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.