Commit ddcd2521 authored by xjm's avatar xjm

Issue #3079805 by mikelutz, xjm, Mixologic, tedbow: expectedException() usage...

Issue #3079805 by mikelutz, xjm, Mixologic, tedbow: expectedException() usage in two pre-8.7.7 commits has broken PHP 5 testing for 8.7.x
parent b6bb2de8
......@@ -23,8 +23,7 @@ public function testUnknownDateType() {
$migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal();
$plugin = new DateField([], '', []);
$this->expectException(MigrateException::class);
$this->expectExceptionMessage("Field field_date of type 'timestamp' is an unknown date field type.");
$this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
$plugin->processFieldValues($migration, 'field_date', ['type' => 'timestamp']);
}
......
......@@ -83,7 +83,7 @@ public function testDefineValueProcessPipelineException() {
$plugin = new DateField([], '', []);
$this->expectException(MigrateException::class);
$this->setExpectedException(MigrateException::class, "Field field_date of type 'totoro' is an unknown date field type.");
$plugin->defineValueProcessPipeline($migration, 'field_date', ['type' => 'totoro']);
}
......
......@@ -102,8 +102,7 @@ public function testKernelRebuildDuringHookInstall() {
* @covers ::install
*/
public function testInvalidCoreInstall($module_name, $install_dependencies) {
$this->expectException(MissingDependencyException::class);
$this->expectExceptionMessage("Unable to install modules: module '$module_name' is incompatible with this version of Drupal core.");
$this->setExpectedException(MissingDependencyException::class, "Unable to install modules: module '$module_name' is incompatible with this version of Drupal core.");
$this->container->get('module_installer')->install([$module_name], $install_dependencies);
}
......@@ -137,8 +136,7 @@ public function providerTestInvalidCoreInstall() {
* @covers ::install
*/
public function testDependencyInvalidCoreInstall() {
$this->expectException(MissingDependencyException::class);
$this->expectExceptionMessage("Unable to install modules: module 'system_incompatible_core_version_dependencies_test'. Its dependency module 'system_incompatible_core_version_test' is incompatible with this version of Drupal core.");
$this->setExpectedException(MissingDependencyException::class, "Unable to install modules: module 'system_incompatible_core_version_dependencies_test'. Its dependency module 'system_incompatible_core_version_test' is incompatible with this version of Drupal core.");
$this->container->get('module_installer')->install(['system_incompatible_core_version_dependencies_test']);
}
......
......@@ -97,8 +97,7 @@ public function testInfoParserMissingKeys() {
],
]);
$filename = vfsStream::url('modules/fixtures/missing_keys.info.txt');
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage('Missing required keys (type, name) in vfs://modules/fixtures/missing_keys.info.txt');
$this->setExpectedException(InfoParserException::class, 'Missing required keys (type, name) in vfs://modules/fixtures/missing_keys.info.txt');
$this->infoParser->parse($filename);
}
......@@ -127,8 +126,7 @@ public function testMissingCoreCoreVersionRequirement() {
]);
$exception_message = "The 'core' or the 'core_version_requirement' key must be present in vfs://modules/fixtures/missing_core_and_core_version_requirement";
// Set the expected exception for the 2nd call to parse().
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage("$exception_message-duplicate.info.txt");
$this->setExpectedException(InfoParserException::class, "$exception_message-duplicate.info.txt");
try {
$this->infoParser->parse(vfsStream::url('modules/fixtures/missing_core_and_core_version_requirement.info.txt'));
......@@ -197,8 +195,7 @@ public function testCoreCoreVersionRequirement88() {
]);
$exception_message = "The 'core_version_requirement' constraint (^8.8) requires the 'core' key not be set in vfs://modules/fixtures/core_and_core_version_requirement_88";
// Set the expected exception for the 2nd call to parse().
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage("$exception_message-duplicate.info.txt");
$this->setExpectedException(InfoParserException::class, "$exception_message-duplicate.info.txt");
try {
$this->infoParser->parse(vfsStream::url('modules/fixtures/core_and_core_version_requirement_88.info.txt'));
}
......@@ -237,8 +234,7 @@ public function testInvalidCore() {
]);
$exception_message = "Invalid 'core' value \"^8\" in vfs://modules/fixtures/invalid_core";
// Set the expected exception for the 2nd call to parse().
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage("$exception_message-duplicate.info.txt");
$this->setExpectedException(InfoParserException::class, "$exception_message-duplicate.info.txt");
try {
$this->infoParser->parse(vfsStream::url('modules/fixtures/invalid_core.info.txt'));
......@@ -279,8 +275,7 @@ public function testCoreVersionRequirementInvalid($test_case, $constraint) {
]);
$exception_message = "The 'core_version_requirement' can not be used to specify compatibility for a specific version before 8.7.7 in vfs://modules/fixtures/invalid_core_version_requirement-$test_case";
// Set the expected exception for the 2nd call to parse().
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage("$exception_message-duplicate.info.txt");
$this->setExpectedException(InfoParserException::class, "$exception_message-duplicate.info.txt");
try {
$this->infoParser->parse(vfsStream::url("modules/fixtures/invalid_core_version_requirement-$test_case.info.txt"));
}
......@@ -333,8 +328,7 @@ public function testInfoParserMissingKey() {
catch (InfoParserException $exception) {
$this->assertSame('Missing required keys (type) in vfs://modules/fixtures/missing_key.info.txt', $exception->getMessage());
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage('Missing required keys (type) in vfs://modules/fixtures/missing_key-duplicate.info.txt');
$this->setExpectedException(InfoParserException::class, 'Missing required keys (type) in vfs://modules/fixtures/missing_key-duplicate.info.txt');
$this->infoParser->parse(vfsStream::url('modules/fixtures/missing_key-duplicate.info.txt'));
}
......@@ -449,8 +443,7 @@ public function testInvalidProfile() {
'invalid_profile.info.txt' => $profile,
],
]);
$this->expectException('\Drupal\Core\Extension\InfoParserException');
$this->expectExceptionMessage("The 'core_version_requirement' key is not supported in profiles in vfs://profiles/fixtures/invalid_profile.info.txt");
$this->setExpectedException(InfoParserException::class, "The 'core_version_requirement' key is not supported in profiles in vfs://profiles/fixtures/invalid_profile.info.txt");
$this->infoParser->parse(vfsStream::url('profiles/fixtures/invalid_profile.info.txt'));
}
......@@ -476,8 +469,7 @@ public function testUnparsableCoreVersionRequirement() {
'unparsable_core_version_requirement.info.txt' => $unparsable_core_version_requirement,
],
]);
$this->expectException(\UnexpectedValueException::class);
$this->expectExceptionMessage('Could not parse version constraint not-this-version: Invalid version string "not-this-version"');
$this->setExpectedException(\UnexpectedValueException::class, 'Could not parse version constraint not-this-version: Invalid version string "not-this-version"');
$this->infoParser->parse(vfsStream::url('modules/fixtures/unparsable_core_version_requirement.info.txt'));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment