Unverified Commit b6f89926 authored by alexpott's avatar alexpott

Issue #3008720 by quietone, neclimdul, dhirendra.mishra, heddn:...

Issue #3008720 by quietone, neclimdul, dhirendra.mishra, heddn: DrupalSqlBase::getSystemData eats exceptions causing DrupalSqlBase::checkRequirements to be less useful on database errors than it should be

(cherry picked from commit 5123f756)
parent 472574a3
...@@ -102,6 +102,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -102,6 +102,7 @@ public static function create(ContainerInterface $container, array $configuratio
* {@inheritdoc} * {@inheritdoc}
*/ */
public function checkRequirements() { public function checkRequirements() {
parent::checkRequirements();
if ($this->pluginDefinition['requirements_met'] === TRUE) { if ($this->pluginDefinition['requirements_met'] === TRUE) {
if (isset($this->pluginDefinition['source_module'])) { if (isset($this->pluginDefinition['source_module'])) {
if ($this->moduleExists($this->pluginDefinition['source_module'])) { if ($this->moduleExists($this->pluginDefinition['source_module'])) {
...@@ -114,7 +115,6 @@ public function checkRequirements() { ...@@ -114,7 +115,6 @@ public function checkRequirements() {
} }
} }
} }
parent::checkRequirements();
} }
/** /**
......
...@@ -63,6 +63,22 @@ public function testSourceProviderNotActive() { ...@@ -63,6 +63,22 @@ public function testSourceProviderNotActive() {
} }
} }
/**
* @covers ::checkRequirements
*/
public function testSourceDatabaseError() {
$plugin_definition['requirements_met'] = TRUE;
$plugin_definition['source_module'] = 'module1';
/** @var \Drupal\Core\State\StateInterface $state */
$state = $this->getMock('Drupal\Core\State\StateInterface');
/** @var \Drupal\Core\Entity\EntityManagerInterface $entity_manager */
$entity_manager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface');
$plugin = new TestDrupalSqlBase([], 'test', $plugin_definition, $this->getMigration(), $state, $entity_manager);
$system_data = $plugin->getSystemData();
$this->setExpectedException(RequirementsException::class, 'No database connection configured for source plugin test');
$plugin->checkRequirements();
}
} }
namespace Drupal\Tests\migrate_drupal\Unit\source; namespace Drupal\Tests\migrate_drupal\Unit\source;
......
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