Issue #2409437 by phenaproxima, hosef, mikeryan, chx, jcost: Migration path for Simpletest 7.x

8.0.x
webchick 2015-08-03 10:22:50 -07:00
parent 6b3fb00867
commit c1e0ba38e8
3 changed files with 80 additions and 1 deletions

View File

@ -289,6 +289,21 @@ class Variable extends DrupalDumpBase {
))->values(array(
'name' => 'search_default_module',
'value' => 's:4:"node";',
))->values(array(
'name' => 'simpletest_clear_results',
'value' => 'b:1;',
))->values(array(
'name' => 'simpletest_httpauth_method',
'value' => 'i:1;',
))->values(array(
'name' => 'simpletest_httpauth_password',
'value' => 's:6:"foobaz";',
))->values(array(
'name' => 'simpletest_httpauth_username',
'value' => 's:7:"testbot";',
))->values(array(
'name' => 'simpletest_verbose',
'value' => 'b:1;',
))->values(array(
'name' => 'site_403',
'value' => 's:4:"node";',
@ -449,4 +464,4 @@ class Variable extends DrupalDumpBase {
}
}
#5b6552f715939e2b33c22779e47e73e3
#029f6b476578be5d7449a86251be1c77

View File

@ -0,0 +1,21 @@
id: d7_simpletest_settings
label: Drupal 7 SimpleTest configuration
migration_tags:
- Drupal 7
source:
plugin: variable
variables:
- simpletest_clear_results
- simpletest_httpauth_method
- simpletest_httpauth_password
- simpletest_httpauth_username
- simpletest_verbose
process:
clear_results: simpletest_clear_results
'httpauth/method': simpletest_httpauth_method
'httpauth/password': simpletest_httpauth_password
'httpauth/username': simpletest_httpauth_username
verbose: simpletest_verbose
destination:
plugin: config
config_name: simpletest.settings

View File

@ -0,0 +1,43 @@
<?php
/**
* @file
* Contains \Drupal\simpletest\Tests\Migrate\d7\MigrateSimpletestSettingsTest.
*/
namespace Drupal\simpletest\Tests\Migrate\d7;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
/**
* Tests migration of SimpleTest's variables to configuration.
*
* @group simpletest
*/
class MigrateSimpletestSettingsTest extends MigrateDrupal7TestBase {
public static $modules = ['simpletest'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installConfig(static::$modules);
$this->loadDumps(['Variable.php']);
$this->executeMigration('d7_simpletest_settings');
}
/**
* Tests migration of SimpleTest settings to configuration.
*/
public function testMigration() {
$config = \Drupal::config('simpletest.settings')->get();
$this->assertTrue($config['clear_results']);
$this->assertIdentical(CURLAUTH_BASIC, $config['httpauth']['method']);
$this->assertIdentical('testbot', $config['httpauth']['username']);
$this->assertIdentical('foobaz', $config['httpauth']['password']);
$this->assertTrue($config['verbose']);
}
}