TestSmartSqlIdMap.php in Smart SQL ID Map 1.1.x
File
tests/src/Unit/TestSmartSqlIdMap.php
View source
<?php
namespace Drupal\Tests\smart_sql_idmap\Unit;
use Drupal\Core\Database\Connection;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\smart_sql_idmap\Plugin\migrate\id_map\SmartSql;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class TestSmartSqlIdMap extends SmartSql implements \Iterator {
protected $migrationPluginManager;
public function __construct(Connection $database, MigrationPluginManagerInterface $migration_plugin_manager, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
$this->database = $database;
$this->migrationPluginManager = $migration_plugin_manager;
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $event_dispatcher);
}
public $message;
protected function getMigrationPluginManager() {
return $this->migrationPluginManager;
}
protected function getFieldSchema(array $id_definition) {
if (!isset($id_definition['type'])) {
return [];
}
switch ($id_definition['type']) {
case 'integer':
return [
'type' => 'int',
'not null' => TRUE,
];
case 'string':
return [
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
];
default:
throw new MigrateException($id_definition['type'] . ' not supported');
}
}
}
Classes
Name |
Description |
TestSmartSqlIdMap |
A Smart SQL ID map-based plugin that can be used for testing SmartSql. |