Issue #2756229 by mohit1604, RumyanaRuseva, quietone, heddn, 5to1: Improve destination missing exception message
parent
8ea7023787
commit
508a63e7cd
|
@ -76,7 +76,7 @@ abstract class DestinationBase extends PluginBase implements MigrateDestinationI
|
||||||
*/
|
*/
|
||||||
public function checkRequirements() {
|
public function checkRequirements() {
|
||||||
if (empty($this->pluginDefinition['requirements_met'])) {
|
if (empty($this->pluginDefinition['requirements_met'])) {
|
||||||
throw new RequirementsException();
|
throw new RequirementsException(sprintf("Destination plugin '%s' did not meet the requirements", $this->pluginId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\Tests\migrate\Unit\Plugin\migrate\destination;
|
||||||
|
|
||||||
|
use Drupal\Core\Config\ConfigFactoryInterface;
|
||||||
|
use Drupal\Core\Language\LanguageManagerInterface;
|
||||||
|
use Drupal\Tests\UnitTestCase;
|
||||||
|
use Drupal\migrate\Exception\RequirementsException;
|
||||||
|
use Drupal\migrate\Plugin\MigrationInterface;
|
||||||
|
use Drupal\migrate\Plugin\migrate\destination\Config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests check requirements exception on DestinationBase.
|
||||||
|
*
|
||||||
|
* @group migrate
|
||||||
|
*/
|
||||||
|
class CheckRequirementsTest extends UnitTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the check requirements exception message.
|
||||||
|
*/
|
||||||
|
public function testException() {
|
||||||
|
$destination = new Config(
|
||||||
|
['config_name' => 'test'],
|
||||||
|
'test',
|
||||||
|
[],
|
||||||
|
$this->prophesize(MigrationInterface::class)->reveal(),
|
||||||
|
$this->prophesize(ConfigFactoryInterface::class)->reveal(),
|
||||||
|
$this->prophesize(LanguageManagerInterface::class)->reveal()
|
||||||
|
);
|
||||||
|
$this->setExpectedException(RequirementsException::class, "Destination plugin 'test' did not meet the requirements");
|
||||||
|
$destination->checkRequirements();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue