Unverified Commit 9f76972c authored by alexpott's avatar alexpott

Issue #2960013 by quietone, Jo Fitzgerald, mikeryan, alexpott: i18n menu links...

Issue #2960013 by quietone, Jo Fitzgerald, mikeryan, alexpott: i18n menu links translation in wrong directory
parent f22c3b09
......@@ -15,7 +15,12 @@ class MigrateMenuLinkTranslationTest extends MigrateDrupal6TestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['menu_ui', 'menu_link_content', 'language'];
public static $modules = [
'menu_ui',
'menu_link_content',
'language',
'content_translation',
];
/**
* {@inheritdoc}
......
<?php
namespace Drupal\Tests\migrate_drupal_ui\Functional;
/**
* Tests the upgrade review form without translations.
*
* When using this test class do not enable content_translation.
*/
abstract class MigrateUpgradeI18nReviewPageTestBase extends MigrateUpgradeReviewPageTestBase {
/**
* Tests the review page when content_translation is enabled.
*/
public function testMigrateUpgradeReviewPage() {
$this->prepare();
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->drupalPostForm(NULL, $this->edits, t('Review upgrade'));
$session = $this->assertSession();
$session->pageTextContains('WARNING: Content may be overwritten on your new site.');
$session->pageTextContains('There is conflicting content of these types:');
$session->pageTextContains('taxonomy terms');
$session->pageTextNotContains('There is translated content of these types:');
$session->pageTextNotContains('custom menu links');
$this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.'));
$session->statusCodeEquals(200);
// Ensure there are no errors about missing modules from the test module.
$session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
$session->pageTextNotContains(t('Source module not found for migration_provider_test.'));
$session->pageTextNotContains(t('Destination module not found for migration_provider_test'));
// Ensure there are no errors about any other missing migration providers.
$session->pageTextNotContains(t('module not found'));
// Test the upgrade paths.
$available_paths = $this->getAvailablePaths();
$missing_paths = $this->getMissingPaths();
$this->assertUpgradePaths($session, $available_paths, $missing_paths);
}
}
......@@ -11,22 +11,17 @@ abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase {
use CreateTestContentEntitiesTrait;
/**
* An array suitable for drupalPostForm().
*
* @var array
*/
protected $edits = [];
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'content_translation',
'migrate_drupal_ui',
'telephone',
'aggregator',
'book',
'forum',
'statistics',
'syslog',
'tracker',
'update',
];
public static $modules = ['migrate_drupal_ui'];
/**
* Tests the migrate upgrade review form.
......@@ -51,6 +46,56 @@ abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase {
* @see \Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase
*/
public function testMigrateUpgradeReviewPage() {
$this->prepare();
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->drupalPostForm(NULL, $this->edits, t('Review upgrade'));
$this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.'));
// Ensure there are no errors about missing modules from the test module.
$session = $this->assertSession();
$session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
$session->pageTextNotContains(t('Source module not found for migration_provider_test.'));
$session->pageTextNotContains(t('Destination module not found for migration_provider_test'));
// Ensure there are no errors about any other missing migration providers.
$session->pageTextNotContains(t('module not found'));
// Test the upgrade paths.
$available_paths = $this->getAvailablePaths();
$missing_paths = $this->getMissingPaths();
$this->assertUpgradePaths($session, $available_paths, $missing_paths);
// Check there are no errors when a module in noUpgradePaths is not in the
// source system tables. Test with a module that is listed in noUpgradePaths
// for both Drupal 6 and Drupal 7.
// @see \Drupal\migrate_drupal_ui\Form\ReviewForm::$noUpgradePaths
$module = 'help';
$query = $this->sourceDatabase->delete('system');
$query->condition('type', 'module');
$query->condition('name', $module);
$query->execute();
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->drupalPostForm(NULL, $this->edits, t('Review upgrade'));
$this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.'));
// Test the upgrade paths.
$available_paths = $this->getAvailablePaths();
$available_paths = array_diff($available_paths, [$module]);
$missing_paths = $this->getMissingPaths();
$this->assertUpgradePaths($session, $available_paths, $missing_paths);
}
/**
* Performs preparation for the form tests.
*
* This is not done in setup because setup executes before the source database
* is loaded.
*/
public function prepare() {
$connection_options = $this->sourceDatabase->getConnectionOptions();
$driver = $connection_options['driver'];
$connection_options['prefix'] = $connection_options['prefix']['default'];
......@@ -75,7 +120,7 @@ public function testMigrateUpgradeReviewPage() {
if (count($drivers) !== 1) {
$edit['driver'] = $driver;
}
$edits = $this->translatePostValues($edit);
$this->edits = $this->translatePostValues($edit);
// Enable all modules in the source except test and example modules, but
// include simpletest.
......@@ -91,47 +136,6 @@ public function testMigrateUpgradeReviewPage() {
$conditions->condition('name', 'simpletest');
$update->condition($conditions);
$update->execute();
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->drupalPostForm(NULL, $edits, t('Review upgrade'));
$this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.'));
// Ensure there are no errors about missing modules from the test module.
$session = $this->assertSession();
$session->pageTextNotContains(t('Source module not found for migration_provider_no_annotation.'));
$session->pageTextNotContains(t('Source module not found for migration_provider_test.'));
$session->pageTextNotContains(t('Destination module not found for migration_provider_test'));
// Ensure there are no errors about any other missing migration providers.
$session->pageTextNotContains(t('module not found'));
// Test the upgrade paths.
$available_paths = $this->getAvailablePaths();
$missing_paths = $this->getMissingPaths();
$this->assertUpgradePaths($session, $available_paths, $missing_paths);
// Check there are no errors when a module in noUpgradePaths is not in the
// source system tables. Test with a module that is listed in noUpgradePaths
// for both Drupal 6 and Drupal 7.
// @see \Drupal\migrate_drupal_ui\Form\ReviewForm::$noUpgradePaths
$module = 'help';
$query = $this->sourceDatabase->delete('system');
$query->condition('type', 'module');
$query->condition('name', $module);
$query->execute();
// Start the upgrade process.
$this->drupalGet('/upgrade');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->drupalPostForm(NULL, $edits, t('Review upgrade'));
$this->drupalPostForm(NULL, [], t('I acknowledge I may lose data. Continue anyway.'));
// Test the upgrade paths.
$available_paths = $this->getAvailablePaths();
$available_paths = array_diff($available_paths, [$module]);
$missing_paths = $this->getMissingPaths();
$this->assertUpgradePaths($session, $available_paths, $missing_paths);
}
/**
......
<?php
namespace Drupal\Tests\migrate_drupal_ui\Functional\d6;
use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeI18nReviewPageTestBase;
/**
* Tests migrate upgrade review page for Drupal 6 without translations.
*
* @group migrate_drupal_6
* @group migrate_drupal_ui
*/
class MigrateUpgrade6I18nReviewPageTest extends MigrateUpgradeI18nReviewPageTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'telephone',
'aggregator',
'book',
'forum',
'statistics',
'syslog',
'tracker',
'update',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php');
}
/**
* {@inheritdoc}
*/
protected function getSourceBasePath() {
return __DIR__ . '/files';
}
/**
* {@inheritdoc}
*/
protected function getAvailablePaths() {
return [
'aggregator',
'block',
'book',
'comment',
'contact',
'content',
'date',
'dblog',
'email',
'filefield',
'filter',
'forum',
'i18ntaxonomy',
'imagecache',
'imagefield',
'language',
'link',
'locale',
'menu',
'node',
'nodereference',
'optionwidgets',
'path',
'profile',
'search',
'statistics',
'syslog',
'system',
'taxonomy',
'text',
'update',
'upload',
'user',
'userreference',
// Include modules that do not have an upgrade path, defined in the
// $noUpgradePath property in MigrateUpgradeForm.
'blog',
'blogapi',
'calendarsignup',
'color',
'content_copy',
'content_multigroup',
'content_permissions',
'date_api',
'date_locale',
'date_php4',
'date_popup',
'date_repeat',
'date_timezone',
'date_tools',
'datepicker',
'ddblock',
'event',
'fieldgroup',
'filefield_meta',
'help',
'i18n',
'i18nstrings',
'imageapi',
'imageapi_gd',
'imageapi_imagemagick',
'imagecache_ui',
'jquery_ui',
'nodeaccess',
'number',
'openid',
'php',
'ping',
'poll',
'throttle',
'tracker',
'translation',
'trigger',
'variable',
'variable_admin',
'views_export',
'views_ui',
];
}
/**
* {@inheritdoc}
*/
protected function getMissingPaths() {
return [
'devel',
'devel_generate',
'devel_node_access',
'i18nblocks',
'i18ncck',
'i18ncontent',
'i18nmenu',
'i18npoll',
'i18nprofile',
'i18nsync',
'i18nviews',
'phone',
'views',
];
}
}
......@@ -12,6 +12,22 @@
*/
class MigrateUpgrade6ReviewPageTest extends MigrateUpgradeReviewPageTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'content_translation',
'telephone',
'aggregator',
'book',
'forum',
'statistics',
'syslog',
'tracker',
'update',
];
/**
* {@inheritdoc}
*/
......
......@@ -12,6 +12,22 @@
*/
class MigrateUpgrade7ReviewPageTest extends MigrateUpgradeReviewPageTestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'content_translation',
'telephone',
'aggregator',
'book',
'forum',
'statistics',
'syslog',
'tracker',
'update',
];
/**
* {@inheritdoc}
*/
......
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