Commit 6f7f400b authored by xjm's avatar xjm

Issue #2790111 by neclimdul, mikeryan: DrupalSqlBase doesn't include missing...

Issue #2790111 by neclimdul, mikeryan: DrupalSqlBase doesn't include missing source in requirements exception
parent 0e9422a3
......@@ -102,7 +102,7 @@ public function checkRequirements() {
}
}
else {
throw new RequirementsException('The module ' . $this->pluginDefinition['source_provider'] . ' is not enabled in the source site.');
throw new RequirementsException('The module ' . $this->pluginDefinition['source_provider'] . ' is not enabled in the source site.', ['source_provider' => $this->pluginDefinition['source_provider']]);
}
}
}
......
......@@ -42,7 +42,6 @@ class DrupalSqlBaseTest extends MigrateTestCase {
* @covers ::checkRequirements
*/
public function testSourceProviderNotActive() {
$this->setExpectedException(RequirementsException::class, 'The module module1 is not enabled in the source site.');
$plugin_definition['requirements_met'] = TRUE;
$plugin_definition['source_provider'] = 'module1';
/** @var \Drupal\Core\State\StateInterface $state */
......@@ -52,7 +51,16 @@ public function testSourceProviderNotActive() {
$plugin = new TestDrupalSqlBase([], 'placeholder_id', $plugin_definition, $this->getMigration(), $state, $entity_manager);
$plugin->setDatabase($this->getDatabase($this->databaseContents));
$system_data = $plugin->getSystemData();
$plugin->checkRequirements();
$this->setExpectedException(RequirementsException::class, 'The module module1 is not enabled in the source site.');
try {
$plugin->checkRequirements();
}
catch (RequirementsException $e) {
// Ensure requirements are set on the exception.
$this->assertEquals(['source_provider' => 'module1'], $e->getRequirements());
// Re-throw so PHPUnit can assert the exception.
throw $e;
}
}
}
......
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