diff --git a/core/modules/system/tests/src/Functional/Module/DependencyTest.php b/core/modules/system/tests/src/Functional/Module/DependencyTest.php index f0be0e2a48..8c69907678 100644 --- a/core/modules/system/tests/src/Functional/Module/DependencyTest.php +++ b/core/modules/system/tests/src/Functional/Module/DependencyTest.php @@ -81,11 +81,11 @@ public function testIncompatibleModuleVersionDependency() { /** * Tests module that depends on an incompatible semantic version of a module. */ - public function testIncompatibleModuleSemanticVersionDependency() { + public function testCompatibilityModuleSemanticVersionDependency() { + $assert_session = $this->assertSession(); + + // Test that common_test is marked as having an incompatible dependency. \Drupal::state()->set('system_test.semantic_test', ['system_version' => '8.99.2', 'dependency' => 'drupal:system (>= 8.99.3)']); - // Test that the - // system_incompatible_module_semantic_version_dependencies_test is marked - // as having an incompatible dependency. $this->drupalGet('admin/modules'); $this->assertSession()->elementContains( 'css', @@ -96,6 +96,16 @@ public function testIncompatibleModuleSemanticVersionDependency() { ]) ); $this->assertSession()->fieldDisabled('edit-modules-common-test-enable'); + + // Test that common_test is marked as having a compatible dependency. + \Drupal::state()->set('system_test.semantic_test', ['system_version' => '8.99.2', 'dependency' => 'drupal:system (<= 8.99.2)']); + $this->drupalGet('admin/modules'); + $this->assertFalse($assert_session->elementExists('css', '[name="modules[common_test][enable]"]')->hasAttribute('disabled')); + + // Ensure the module can actually be installed. + $edit['modules[common_test][enable]'] = 'common_test'; + $this->drupalPostForm('admin/modules', $edit, t('Install')); + $this->assertModules(['common_test'], TRUE); } /** diff --git a/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php b/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php index 49ca202a82..ed5db3a770 100644 --- a/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php +++ b/core/tests/Drupal/Tests/Component/Version/ConstraintTest.php @@ -129,21 +129,6 @@ public function providerIsCompatible() { $tests['(8.8.1-8.8.2'] = [$semantic_equal, '8.8.2', FALSE]; $tests['(8.8.1-8.9.0'] = [$semantic_equal, '8.9.0', FALSE]; - // Test semantic minor with "x" which we should NOT support. - $semantic_less_or_equal_minor_x = new Constraint('>= 8.x.x', '8.x'); - $tests['>= 8.x.x-8.7.x'] = [$semantic_less_or_equal_minor_x, '8.7.0', TRUE]; - - // Test semantic minor with "x" which we should NOT support. - $semantic_less_or_equal_minor_x = new Constraint('>= 8.x.1', '8.x'); - $tests['>= 8.x.1-8.7.x'] = [$semantic_less_or_equal_minor_x, '8.7.0', TRUE]; - - // Test semantic minor with "x" which we should NOT support. - $semantic_greater_or_equal_minor_x = new Constraint('<= 8.x.x', '8.x'); - $tests['<= 8.x.x-8.7.x'] = [$semantic_greater_or_equal_minor_x, '8.7.0', TRUE]; - - // Test semantic minor with "x" which we should NOT support. - $semantic_greater_or_equal_minor_x = new Constraint('<= 8.x.1', '8.x'); - $tests['<= 8.x.1-8.7.x'] = [$semantic_greater_or_equal_minor_x, '8.7.0', TRUE]; return $tests; }