NodeClassicTest.php in Drupal 8
File
core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
View source
<?php
namespace Drupal\Tests\migrate_drupal_ui\Functional\d6;
use Drupal\migrate_drupal\NodeMigrateType;
use Drupal\Tests\migrate_drupal\Traits\NodeMigrateTypeTestTrait;
use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
class NodeClassicTest extends MigrateUpgradeExecuteTestBase {
use NodeMigrateTypeTestTrait;
public static $modules = [
'language',
'content_translation',
'config_translation',
'migrate_drupal_ui',
'telephone',
'aggregator',
'book',
'forum',
'statistics',
'migrate_drupal_multilingual',
];
protected function setUp() {
parent::setUp();
$this
->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php');
}
protected function getSourceBasePath() {
return __DIR__ . '/files';
}
protected function getEntityCounts() {
}
protected function getEntityCountsIncremental() {
}
protected function getAvailablePaths() {
}
protected function getMissingPaths() {
}
public function testMigrateUpgradeExecute() {
$this
->makeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '6');
$connection_options = $this->sourceDatabase
->getConnectionOptions();
$this
->drupalGet('/upgrade');
$session = $this
->assertSession();
$session
->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal {$this->destinationSiteVersion}.");
$this
->drupalPostForm(NULL, [], t('Continue'));
$session
->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
$session
->fieldExists('mysql[host]');
$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,
];
$edit['d6_source_base_path'] = $this
->getSourceBasePath();
if (count($drivers) !== 1) {
$edit['driver'] = $driver;
}
$edits = $this
->translatePostValues($edit);
$this
->drupalGet('/upgrade');
$session
->responseContains("Upgrade a site by importing its files and the data from its database into a clean and empty new install of Drupal {$this->destinationSiteVersion}.");
$this
->drupalPostForm(NULL, [], t('Continue'));
$session
->pageTextContains('Provide credentials for the database of the Drupal site you want to upgrade.');
$session
->fieldExists('mysql[host]');
$this
->drupalPostForm(NULL, $edits, t('Review upgrade'));
$results = $this
->nodeMigrateMapTableCount('6');
$this
->assertSame(13, $results['node']);
$this
->assertSame(0, $results['node_complete']);
}
}