You are here

public function DependencyTest::testCoreCompatibility in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Module/DependencyTest.php \Drupal\Tests\system\Functional\Module\DependencyTest::testCoreCompatibility()
  2. 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 111

Class

DependencyTest
Enable module without dependency enabled.

Namespace

Drupal\Tests\system\Functional\Module

Code

public function testCoreCompatibility() {
  $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);
}