diff --git a/core/modules/update/src/ModuleVersion.php b/core/modules/update/src/ModuleVersion.php index cec4abc95f..b25334b9f0 100644 --- a/core/modules/update/src/ModuleVersion.php +++ b/core/modules/update/src/ModuleVersion.php @@ -6,6 +6,8 @@ * Provides a module version value object. * * @internal + * + * @see https://www.drupal.org/drupalorg/docs/apis/update-status-xml. */ final class ModuleVersion { @@ -50,7 +52,7 @@ public static function createFromVersionString($version_string) { if ($dot_x_position === 1 || $dot_x_position === 2) { $after_core_prefix = explode('.x-', $version_string)[1]; if ($after_core_prefix !== 'dev') { - throw new \UnexpectedValueException("Unexpected version core prefix in $version_string. The only core prefix expected in \Drupal\update\ModuleVersion is '8.x-."); + throw new \UnexpectedValueException("Unexpected version core prefix in $version_string. The only core prefix expected in \Drupal\update\ModuleVersion is: 8.x-"); } } } @@ -66,7 +68,7 @@ public static function createFromVersionString($version_string) { // allowed is in development versions like 8.x-1.x-dev, 1.2.x-dev or // 1.x-dev. || (!is_numeric($last_part_split[0]) && $last_part_split !== 'x' && $version_extra !== 'dev')) { - throw new \UnexpectedValueException("Unexpected version number in $original_version."); + throw new \UnexpectedValueException("Unexpected version number in: $original_version"); } return new static($major_version, $version_extra); } diff --git a/core/modules/update/tests/src/Unit/ModuleVersionTest.php b/core/modules/update/tests/src/Unit/ModuleVersionTest.php index 64465d2c00..ef3102d0ba 100644 --- a/core/modules/update/tests/src/Unit/ModuleVersionTest.php +++ b/core/modules/update/tests/src/Unit/ModuleVersionTest.php @@ -197,7 +197,7 @@ public function providerVersionInfos() { */ public function testInvalidVersionNumber($version_string) { $this->expectException(\UnexpectedValueException::class); - $this->expectExceptionMessage("Unexpected version number in $version_string."); + $this->expectExceptionMessage("Unexpected version number in: $version_string"); ModuleVersion::createFromVersionString($version_string); } @@ -234,7 +234,7 @@ public function providerInvalidVersionNumber() { */ public function testInvalidVersionCorePrefix($version_string) { $this->expectException(\UnexpectedValueException::class); - $this->expectExceptionMessage("Unexpected version core prefix in $version_string. The only core prefix expected in \Drupal\update\ModuleVersion is '8.x-."); + $this->expectExceptionMessage("Unexpected version core prefix in $version_string. The only core prefix expected in \Drupal\update\ModuleVersion is: 8.x-"); ModuleVersion::createFromVersionString($version_string); } @@ -254,10 +254,13 @@ public function providerInvalidVersionCorePrefix() { * @covers ::createFromSupportBranch * * @dataProvider providerInvalidBranchCorePrefix + * + * @param string $branch + * The branch to test. */ public function testInvalidBranchCorePrefix($branch) { $this->expectException(\UnexpectedValueException::class); - $this->expectExceptionMessage("Unexpected version core prefix in {$branch}0. The only core prefix expected in \Drupal\update\ModuleVersion is '8.x-."); + $this->expectExceptionMessage("Unexpected version core prefix in {$branch}0. The only core prefix expected in \Drupal\update\ModuleVersion is: 8.x-"); ModuleVersion::createFromSupportBranch($branch); } @@ -277,6 +280,12 @@ public function providerInvalidBranchCorePrefix() { * @covers ::createFromSupportBranch * * @dataProvider providerCreateFromSupportBranch + * + * @param string $branch + * The branch to test. + * + * @param string $expected_major + * The expected major version. */ public function testCreateFromSupportBranch($branch, $expected_major) { $version = ModuleVersion::createFromSupportBranch($branch); @@ -318,6 +327,9 @@ public function providerCreateFromSupportBranch() { * @covers ::createFromSupportBranch * * @dataProvider provideInvalidBranch + * + * @param string $branch + * The branch to test. */ public function testInvalidBranch($branch) { $this->expectException(\UnexpectedValueException::class);