Commit 37001445 authored by alexpott's avatar alexpott

Issue #2505521 by benjy: Clean-up un-need test classes in migrate_drupal

parent b1ffbb00
......@@ -24,6 +24,11 @@ function config_help($route_name, RouteMatchInterface $route_match) {
$output = '';
$output .= '<p>' . t('Import configuration that is placed in your staging directory. All changes, deletions, renames, and additions are listed below.') . '</p>';
return $output;
case 'config.import_full':
$output = '';
$output .= '<p>' . t('After uploading a configuration archive, you will be able to examine the changes and import them.') . '</p>';
return $output;
}
}
......
......@@ -55,13 +55,10 @@ public function getFormId() {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['description'] = array(
'#markup' => '<p>' . $this->t('Use the upload button below.') . '</p>',
);
$form['import_tarball'] = array(
'#type' => 'file',
'#title' => $this->t('Select your configuration export file'),
'#description' => $this->t('This form will redirect you to the import configuration screen.'),
'#title' => $this->t('Configuration archive'),
'#description' => $this->t('Allowed types: @extensions.', array('@extensions' => 'tar.gz tgz')),
);
$form['submit'] = array(
......@@ -80,7 +77,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
$form_state->setValue('import_tarball', $file_upload->getRealPath());
}
else {
$form_state->setErrorByName('import_tarball', $this->t('The import tarball could not be uploaded.'));
$form_state->setErrorByName('import_tarball', $this->t('The file could not be uploaded.'));
}
}
......@@ -97,7 +94,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$files[] = $file['filename'];
}
$archiver->extractList($files, config_get_config_directory(CONFIG_STAGING_DIRECTORY));
drupal_set_message($this->t('Your configuration files were successfully uploaded, ready for import.'));
drupal_set_message($this->t('Your configuration files were successfully uploaded and are ready for import.'));
$form_state->setRedirect('config.sync');
}
catch (\Exception $e) {
......
......@@ -76,11 +76,22 @@ protected function setUp() {
$migration->expects($this->any())
->method('getHighWater')
->will($this->returnValue(static::ORIGINAL_HIGH_WATER));
// Need the test class, not the original because we need a setDatabase method. This is not pretty :/
$plugin_class = preg_replace('/^Drupal\\\\(\w+)\\\\Plugin\\\\migrate(\\\\source(\\\\.+)?\\\\)([^\\\\]+)$/', 'Drupal\\Tests\\\$1\\Unit$2Test$4', static::PLUGIN_CLASS);
// Setup the plugin.
$plugin_class = static::PLUGIN_CLASS;
$plugin = new $plugin_class($this->migrationConfiguration['source'], $this->migrationConfiguration['source']['plugin'], array(), $migration, $entity_manager);
$plugin->setDatabase($this->getDatabase($this->databaseContents + array('test_map' => array())));
$plugin->setModuleHandler($module_handler);
// Do some reflection to set the database and moduleHandler.
$plugin_reflection = new \ReflectionClass($plugin);
$database_property = $plugin_reflection->getProperty('database');
$database_property->setAccessible(TRUE);
$module_handler_property = $plugin_reflection->getProperty('moduleHandler');
$module_handler_property->setAccessible(TRUE);
// Set the database and the module handler onto our plugin.
$database_property->setValue($plugin, $this->getDatabase($this->databaseContents + array('test_map' => array())));
$module_handler_property->setValue($plugin, $module_handler);
$plugin->setStringTranslation($this->getStringTranslationStub());
$migration->expects($this->any())
->method('getSourcePlugin')
......
......@@ -44,17 +44,3 @@ abstract class VariableMultiRowTestBase extends MigrateSqlSourceTestCase {
);
}
namespace Drupal\Tests\migrate_drupal\Unit\source;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
class TestVariableMultiRow extends \Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -46,17 +46,3 @@ class VariableTest extends MigrateSqlSourceTestCase {
);
}
namespace Drupal\Tests\migrate_drupal\Unit\source;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
class TestVariable extends \Drupal\migrate_drupal\Plugin\migrate\source\Variable {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -73,18 +73,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Action;
class TestAction extends Action {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -66,20 +66,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\AggregatorFeed;
class TestAggregatorFeed extends AggregatorFeed {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -55,20 +55,3 @@ class AggregatorItemTest extends MigrateSqlSourceTestCase {
));
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\AggregatorItem;
class TestAggregatorItem extends AggregatorItem {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -83,18 +83,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Block;
class TestBlock extends Block {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -57,18 +57,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Box;
class TestBox extends Box {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -57,18 +57,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\ContactCategory;
class TestContactCategory extends ContactCategory {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -106,16 +106,3 @@ protected function setUp() {
}
}
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\FieldInstancePerViewMode;
class TestFieldInstancePerViewMode extends FieldInstancePerViewMode {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -96,17 +96,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\FieldInstance;
class TestFieldInstance extends FieldInstance {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -78,19 +78,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Field;
class TestField extends Field {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -61,18 +61,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\File;
class TestFile extends File {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -112,18 +112,3 @@ protected function setUp() {
parent::setUp();
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\FilterFormat;
class TestFilterFormat extends FilterFormat {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -116,18 +116,3 @@ public function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\MenuLink;
class TestMenuLink extends MenuLink {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -60,18 +60,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Menu;
class TestMenu extends Menu {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -75,18 +75,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\NodeType;
class TestNodeType extends NodeType {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -94,18 +94,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\ProfileField;
class TestProfileField extends ProfileField {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -86,16 +86,3 @@ protected function setUp() {
}
}
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Role;
class TestRole extends Role {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -53,18 +53,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\UrlAlias;
class TestUrlAlias extends UrlAlias {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -48,18 +48,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\UserPicture;
class TestUserPicture extends UserPicture {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -87,18 +87,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\User;
class TestUser extends User {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -78,16 +78,3 @@ protected function setUp() {
}
}
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\ViewMode;
class TestViewMode extends ViewMode {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
......@@ -78,20 +78,3 @@ protected function setUp() {
}
}
namespace Drupal\Tests\migrate_drupal\Unit\source\d6;
use Drupal\Core\Database\Connection;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\migrate_drupal\Plugin\migrate\source\d6\Vocabulary;
class TestVocabulary extends Vocabulary {
public function setDatabase(Connection $database) {
$this->database = $database;
}
public function setModuleHandler(ModuleHandlerInterface $module_handler) {
$this->moduleHandler = $module_handler;
}
}
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