protected function MigrateTestBase::mockFailure in Drupal 10
Same name and namespace in other branches
- 8 core/modules/migrate/tests/src/Kernel/MigrateTestBase.php \Drupal\Tests\migrate\Kernel\MigrateTestBase::mockFailure()
- 9 core/modules/migrate/tests/src/Kernel/MigrateTestBase.php \Drupal\Tests\migrate\Kernel\MigrateTestBase::mockFailure()
Records a failure in the map table of a specific migration.
This is done in order to test scenarios which require a failed row.
Parameters
string|\Drupal\migrate\Plugin\MigrationInterface $migration: The migration entity, or its ID.
array $row: The raw source row which "failed".
int $status: (optional) The failure status. Should be one of the MigrateIdMapInterface::STATUS_* constants. Defaults to MigrateIdMapInterface::STATUS_FAILED.
6 calls to MigrateTestBase::mockFailure()
- MigrateTermNodeTest::testSkipNonExistentNode in core/
modules/ taxonomy/ tests/ src/ Kernel/ Migrate/ d6/ MigrateTermNodeTest.php - Tests that term associations are ignored when they belong to nodes which were not migrated.
- MigrateUploadEntityDisplayTest::testSkipNonExistentNodeType in core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUploadEntityDisplayTest.php - Tests that entity displays are ignored appropriately.
- MigrateUploadEntityFormDisplayTest::testSkipNonExistentNodeType in core/
modules/ file/ tests/ src/ Kernel/ Migrate/ d6/ MigrateUploadEntityFormDisplayTest.php - Tests that entity displays are ignored appropriately.
- MigrateVocabularyEntityDisplayTest::testSkipNonExistentNodeType in core/
modules/ taxonomy/ tests/ src/ Kernel/ Migrate/ d6/ MigrateVocabularyEntityDisplayTest.php - Tests that vocabulary displays are ignored appropriately.
- MigrateVocabularyEntityFormDisplayTest::testSkipNonExistentNodeType in core/
modules/ taxonomy/ tests/ src/ Kernel/ Migrate/ d6/ MigrateVocabularyEntityFormDisplayTest.php - Tests that vocabulary displays are ignored appropriately.
File
- core/
modules/ migrate/ tests/ src/ Kernel/ MigrateTestBase.php, line 238
Class
- MigrateTestBase
- Creates abstract base class for migration tests.
Namespace
Drupal\Tests\migrate\KernelCode
protected function mockFailure($migration, array $row, $status = MigrateIdMapInterface::STATUS_FAILED) {
if (is_string($migration)) {
$migration = $this
->getMigration($migration);
}
/** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
$destination = array_map(function () {
return NULL;
}, $migration
->getDestinationPlugin()
->getIds());
$row = new Row($row, $migration
->getSourcePlugin()
->getIds());
$migration
->getIdMap()
->saveIdMapping($row, $destination, $status);
}