Unverified Commit 694b95b9 authored by larowlan's avatar larowlan

Issue #2575135 by quietone, ckaotik, olegel, mikeryan, larowlan: Dummy...

Issue #2575135 by quietone, ckaotik, olegel, mikeryan, larowlan: Dummy map/message tables being created
parent bfe514a0
......@@ -25,6 +25,9 @@ public static function getSourcePlugin($source_plugin_id) {
'destination' => [
'plugin' => 'null',
],
'idMap' => [
'plugin' => 'null',
],
];
return \Drupal::service('plugin.manager.migration')->createStubMigration($definition)->getSourcePlugin();
}
......
<?php
namespace Drupal\migrate\Plugin\migrate\id_map;
use Drupal\Core\Plugin\PluginBase;
use Drupal\migrate\MigrateMessageInterface;
use Drupal\migrate\Plugin\MigrateIdMapInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
/**
* Defines the null ID map implementation.
*
* This serves as a dummy in order to not store anything.
*
* @PluginID("null")
*/
class NullIdMap extends PluginBase implements MigrateIdMapInterface {
/**
* {@inheritdoc}
*/
public function setMessage(MigrateMessageInterface $message) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function getRowBySource(array $source_id_values) {
return [];
}
/**
* {@inheritdoc}
*/
public function getRowByDestination(array $destination_id_values) {
return [];
}
/**
* {@inheritdoc}
*/
public function getRowsNeedingUpdate($count) {
return 0;
}
/**
* {@inheritdoc}
*/
public function lookupSourceID(array $destination_id_values) {
return [];
}
/**
* {@inheritdoc}
*/
public function lookupDestinationId(array $source_id_values) {
return [];
}
/**
* {@inheritdoc}
*/
public function lookupDestinationIds(array $source_id_values) {
return [];
}
/**
* {@inheritdoc}
*/
public function saveIdMapping(Row $row, array $destination_id_values, $source_row_status = MigrateIdMapInterface::STATUS_IMPORTED, $rollback_action = MigrateIdMapInterface::ROLLBACK_DELETE) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function saveMessage(array $source_id_values, $message, $level = MigrationInterface::MESSAGE_ERROR) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function getMessageIterator(array $source_id_values = [], $level = NULL) {
return new \ArrayIterator([]);
}
/**
* {@inheritdoc}
*/
public function prepareUpdate() {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function processedCount() {
return 0;
}
/**
* {@inheritdoc}
*/
public function importedCount() {
return 0;
}
/**
* {@inheritdoc}
*/
public function updateCount() {
return 0;
}
/**
* {@inheritdoc}
*/
public function errorCount() {
return 0;
}
/**
* {@inheritdoc}
*/
public function messageCount() {
return 0;
}
/**
* {@inheritdoc}
*/
public function delete(array $source_id_values, $messages_only = FALSE) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function deleteDestination(array $destination_id_values) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function setUpdate(array $source_id_values) {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function clearMessages() {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function destroy() {
// Do nothing.
}
/**
* {@inheritdoc}
*/
public function currentDestination() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function currentSource() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function getQualifiedMapTableName() {
return '';
}
/**
* {@inheritdoc}
*/
public function rewind() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function current() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function key() {
return '';
}
/**
* {@inheritdoc}
*/
public function next() {
return NULL;
}
/**
* {@inheritdoc}
*/
public function valid() {
return FALSE;
}
}
......@@ -40,6 +40,9 @@ function migrate_drupal_migration_plugins_alter(&$definitions) {
'destination' => [
'plugin' => 'null',
],
'idMap' => [
'plugin' => 'null',
],
];
$vocabulary_migration = \Drupal::service('plugin.manager.migration')->createStubMigration($vocabulary_migration_definition);
......
<?php
namespace Drupal\Tests\migrate_drupal\Kernel;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Test that no dummy migrate_map tables are created.
*
* @group migrate_drupal
*/
class IdMapTableNoDummyTest extends MigrateDrupal6TestBase {
/**
* The migration plugin manager.
*
* @var \Drupal\migrate\Plugin\MigrationPluginManagerInterface
*/
protected $pluginManager;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->pluginManager = $this->container->get('plugin.manager.migration');
$this->pluginManager->createInstance('d6_user');
}
/**
* Test that dummy map tables do not exist.
*/
public function testNoDummyTables() {
$database = \Drupal::database();
$tables = $database->schema()->findTables('%migrate_map%');
$dummy_tables = preg_grep("/.*migrate_map_([0-9a-fA-F]){13}/", $tables);
$this->assertCount(0, $dummy_tables);
}
}
......@@ -28,6 +28,7 @@ public function getProcess() {
'ignore_map' => TRUE,
] + $this->source;
$definition['destination']['plugin'] = 'null';
$definition['idMap']['plugin'] = 'null';
try {
$profile_field_migration = $this->migrationPluginManager->createStubMigration($definition);
$source_plugin = $profile_field_migration->getSourcePlugin();
......
......@@ -21,6 +21,7 @@ public function getProcess() {
'ignore_map' => TRUE,
] + $this->source;
$definition['destination']['plugin'] = 'null';
$definition['idMap']['plugin'] = 'null';
if (\Drupal::moduleHandler()->moduleExists('field')) {
$definition['source']['plugin'] = 'd7_field_instance';
$field_migration = $this->migrationPluginManager->createStubMigration($definition);
......
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