diff --git a/core/includes/update.inc b/core/includes/update.inc
index a5ec1f2234..792e94c286 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -58,7 +58,6 @@ function update_check_incompatibility($name, $type = 'module') {
$file = $themes[$name];
}
if (!isset($file)
- || !isset($file->info['core_dependency'])
|| $file->info['core_incompatible']
|| version_compare(phpversion(), $file->info['php']) < 0) {
return TRUE;
diff --git a/core/lib/Drupal/Component/Version/DrupalSemver.php b/core/lib/Drupal/Component/Version/DrupalSemver.php
deleted file mode 100644
index bfce92e17a..0000000000
--- a/core/lib/Drupal/Component/Version/DrupalSemver.php
+++ /dev/null
@@ -1,37 +0,0 @@
- \Drupal::VERSION,
]);
$row['#requires']['core'] = $this->t('Drupal Core (@core_requirement) (incompatible with version @core_version)', [
- '@core_requirement' => $module->info['core_dependency'],
+ '@core_requirement' => $module->info['core_dependency'] ?? $module->info['core'],
'@core_version' => \Drupal::VERSION,
]);
}
diff --git a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
index e0955a1c3a..8c94c70620 100644
--- a/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php
@@ -122,7 +122,6 @@ public function providerTestInvalidCoreInstall() {
];
}
-
/**
* Tests install with a dependency with an invalid core version constraint.
*
diff --git a/core/tests/Drupal/Tests/Component/Version/DrupalSemverTest.php b/core/tests/Drupal/Tests/Component/Version/DrupalSemverTest.php
deleted file mode 100644
index 44285eaba6..0000000000
--- a/core/tests/Drupal/Tests/Component/Version/DrupalSemverTest.php
+++ /dev/null
@@ -1,57 +0,0 @@
-assertSame($result, DrupalSemver::satisfies($version, $constraints));
- }
-
- public function providerSatisfies() {
- $cases = [
- ['8.8.0-dev', '8.x', TRUE],
- ['8.8.0', '8.x', TRUE],
- ['8.9.9', '8.x', TRUE],
- ['8.0.0', '8.x', TRUE],
- ['9.0.0', '8.x', FALSE],
- ['9.1.0', '8.x', FALSE],
- ['8.8.0', '~8', TRUE],
- ['8.8.0', '^8', TRUE],
- ['8.7.0', '^8.7.6', FALSE],
- ['8.7.6', '^8.7.6', TRUE],
- ['8.7.8', '^8.7.6', TRUE],
- ['9.0.0', '^8.7.6', FALSE],
- ['8.0.0', '^8 || ^9', TRUE],
- ['9.1.1', '^8 || ^9', TRUE],
- ['9.1.1', '^8.7.6 || ^9', TRUE],
- ['8.7.8', '^8.7.6 || ^9', TRUE],
- ['8.6.8', '^8.7.6 || ^9', FALSE],
- ['8.6.8', '^9', FALSE],
- ['9.1.1', '^9', TRUE],
- ['9.0.0', '9.x', TRUE],
- ['8.8.0', '9.x', FALSE],
- ['8.8.0', '7.x', FALSE],
- ['a-super-nonsense-string-will-not-throw-an-exception-but-also-will-not-work', '9.x', FALSE],
- ['a-super-nonsense-string-will-not-throw-an-exception-but-also-will-not-work', '7.x', FALSE],
- ['a-super-nonsense-string-will-not-throw-an-exception-but-also-will-not-work', '8.x', FALSE],
- ];
- $tests = [];
- foreach ($cases as $case) {
- $tests[$case[0] . ":" . $case[1]] = $case;
- }
- return $tests;
- }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
index 31f7461637..e874cfb53e 100644
--- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
@@ -223,8 +223,10 @@ public function testInvalidCore() {
* Tests that 'core_dependency' throws an exception if constraint is invalid.
*
* @covers ::parse
+ *
+ * @dataProvider providerCoreDependencyInvalid
*/
- public function testCoreDependencyInvalid() {
+ public function testCoreDependencyInvalid($file_name, $constraint) {
$invalid_core_dependency = << [
- 'invalid_core_dependency.info.txt' => $invalid_core_dependency,
+ "$file_name.info.txt" => $invalid_core_dependency,
],
]);
- $filename = vfsStream::url('modules/fixtures/invalid_core_dependency.info.txt');
+ $filename = vfsStream::url("modules/fixtures/$file_name.info.txt");
$this->expectException('\Drupal\Core\Extension\InfoParserException');
- $this->expectExceptionMessage("The 'core_dependency' can not be used to specify compatibility specific version before 8.7.7 in vfs://modules/fixtures/invalid_core_dependency.info.txt");
+ $this->expectExceptionMessage("The 'core_dependency' can not be used to specify compatibility specific version before 8.7.7 in vfs://modules/fixtures/$file_name.info.txt");
$this->infoParser->parse($filename);
}
+ /**
+ * Dataprovider for testCoreDependencyInvalid().
+ */
+ public function providerCoreDependencyInvalid() {
+ return [
+ '8.0.0-alpha2' => ['alpha2', '8.0.0-alpha2'],
+ '8.6.0-rc1' => ['rc1', '8.6.0-rc1'],
+ '^8.7' => ['8_7', '^8.7'],
+ '>8.6.3' => ['gt8_6_3', '>8.6.3'],
+ ];
+ }
+
/**
* Tests that missing required key is detected.
*
@@ -303,7 +317,6 @@ public function testInfoParserCommonInfo() {
$info_values = $this->infoParser->parse(vfsStream::url('modules/fixtures/common_test.info.txt'));
$this->assertEquals($info_values['simple_string'], 'A simple string', 'Simple string value was parsed correctly.');
$this->assertEquals($info_values['version'], \Drupal::VERSION, 'Constant value was parsed correctly.');
- $this->assertSame($info_values['core_dependency'], '8.x');
$this->assertEquals($info_values['double_colon'], 'dummyClassName::method', 'Value containing double-colon was parsed correctly.');
}
@@ -336,7 +349,7 @@ public function testCoreIncompatibility($file_name, $constraint, $expected) {
}
/**
- * Dataprovider for testCoreIncompatibility()
+ * Dataprovider for testCoreIncompatibility().
*/
public function providerCoreIncompatibility() {
list($major, $minor) = explode('.', \Drupal::VERSION);