MigrateUpgradeReviewPageTestBase.php in Commerce Migrate 8.2
File
modules/ubercart/tests/src/Functional/MigrateUpgradeReviewPageTestBase.php
View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Functional;
use Drupal\migrate_drupal\MigrationConfigurationTrait;
use Drupal\Tests\migrate_drupal\Traits\CreateTestContentEntitiesTrait;
use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeTestBase;
abstract class MigrateUpgradeReviewPageTestBase extends MigrateUpgradeTestBase {
use MigrationConfigurationTrait;
use CreateTestContentEntitiesTrait;
public static $modules = [
'migrate_drupal_ui',
];
protected function setUp() {
parent::setUp();
$this
->writeSettings([
'settings' => [
'migrate_node_migrate_type_classic' => (object) [
'value' => TRUE,
'required' => TRUE,
],
],
]);
}
public function testMigrateUpgradeReviewPage() {
$connection_options = $this->sourceDatabase
->getConnectionOptions();
$driver = $connection_options['driver'];
$connection_options['prefix'] = $connection_options['prefix']['default'];
$drivers = drupal_get_database_types();
$form = $drivers[$driver]
->getFormOptions($connection_options);
$connection_options = array_intersect_key($connection_options, $form + $form['advanced_options']);
$version = $this
->getLegacyDrupalVersion($this->sourceDatabase);
$edit = [
$driver => $connection_options,
'source_private_file_path' => $this
->getSourceBasePath(),
'version' => $version,
];
if ($version == 6) {
$edit['d6_source_base_path'] = $this
->getSourceBasePath();
}
else {
$edit['source_base_path'] = $this
->getSourceBasePath();
}
if (count($drivers) !== 1) {
$edit['driver'] = $driver;
}
$edits = $this
->translatePostValues($edit);
$update = $this->sourceDatabase
->update('system')
->fields([
'status' => 1,
])
->condition('type', 'module');
$and = $update
->andConditionGroup()
->condition('name', '%test%', 'NOT LIKE')
->condition('name', '%example%', 'NOT LIKE');
$conditions = $update
->orConditionGroup();
$conditions
->condition($and);
$conditions
->condition('name', 'simpletest');
$update
->condition($conditions);
$update
->execute();
$this
->drupalGet('/upgrade');
$this
->drupalPostForm(NULL, [], t('Continue'));
$this
->drupalPostForm(NULL, $edits, t('Review upgrade'));
$session = $this
->assertSession();
$available_paths = $this
->getAvailablePaths();
$missing_paths = $this
->getMissingPaths();
$this
->assertUpgradePaths($session, $available_paths, $missing_paths);
}
protected function getEntityCounts() {
return [];
}
protected function getEntityCountsIncremental() {
return [];
}
}