Skip to content
Snippets Groups Projects
Unverified Commit 5123f756 authored by Alex Pott's avatar Alex Pott
Browse files

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
parent 0a6e4639
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -102,6 +102,7 @@ public static function create(ContainerInterface $container, array $configuratio
* {@inheritdoc}
*/
public function checkRequirements() {
parent::checkRequirements();
if ($this->pluginDefinition['requirements_met'] === TRUE) {
if (isset($this->pluginDefinition['source_module'])) {
if ($this->moduleExists($this->pluginDefinition['source_module'])) {
......@@ -114,7 +115,6 @@ public function checkRequirements() {
}
}
}
parent::checkRequirements();
}
/**
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment