Update to drupal-org-drupal 8.0.0-rc2. For more information, see https://www.drupal.org/node/2598668
This commit is contained in:
parent
f32e58e4b1
commit
8e18df8c36
3062 changed files with 15044 additions and 172506 deletions
|
|
@ -9,9 +9,9 @@ namespace Drupal\migrate\Tests;
|
|||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\migrate\Entity\MigrationInterface;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\MigrateMessageInterface;
|
||||
use Drupal\migrate\Plugin\MigrateIdMapInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\simpletest\KernelTestBase;
|
||||
|
||||
|
|
@ -199,4 +199,26 @@ abstract class MigrateTestBase extends KernelTestBase implements MigrateMessageI
|
|||
$this->collectMessages = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a failure in the map table of a specific migration in order to
|
||||
* test scenarios which require a failed row.
|
||||
*
|
||||
* @param string|\Drupal\migrate\Entity\MigrationInterface $migration
|
||||
* The migration entity, or its ID.
|
||||
* @param array $row
|
||||
* The raw source row which "failed".
|
||||
* @param int $status
|
||||
* (optional) The failure status. Should be one of the
|
||||
* MigrateIdMapInterface::STATUS_* constants.
|
||||
*/
|
||||
protected function mockFailure($migration, array $row, $status = MigrateIdMapInterface::STATUS_FAILED) {
|
||||
if (is_string($migration)) {
|
||||
$migration = Migration::load($migration);
|
||||
}
|
||||
/** @var \Drupal\migrate\Entity\MigrationInterface $migration */
|
||||
$destination = array_map(function() { return NULL; }, $migration->getDestinationPlugin()->getIds());
|
||||
$row = new Row($row, $migration->getSourcePlugin()->getIds());
|
||||
$migration->getIdMap()->saveIdMapping($row, $destination, $status);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue