View source
<?php
namespace Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
abstract class Ubercart7TestBase extends MigrateDrupal7TestBase {
protected static $modules = [
'address',
'commerce',
'entity',
'entity_reference_revisions',
'inline_entity_form',
'views',
'commerce_migrate',
'commerce_migrate_ubercart',
];
protected function getFixtureFilePath() {
return __DIR__ . '/../../../../fixtures/uc7.php';
}
protected function migrateAttributes() {
$this
->installEntitySchema('commerce_product_variation');
$this
->installEntitySchema('commerce_product');
$this
->installConfig([
'commerce_product',
]);
$this
->executeMigrations([
'uc_attribute_field',
'uc_product_attribute',
'uc_attribute_field_instance',
'uc_attribute_instance_widget_settings',
]);
}
protected function migrateCommentFields() {
$this
->migrateCommentTypes();
$this
->executeMigrations([
'd7_comment_field',
'uc7_comment_field',
'uc7_comment_field_instance',
]);
}
protected function migrateCommentTypes() {
parent::migrateCommentTypes();
$this
->executeMigration('uc7_comment_type');
}
protected function migrateFields() {
$this
->migrateContentTypes();
$this
->migrateCommentTypes();
$this
->executeMigrations([
'd7_taxonomy_vocabulary',
'd7_field',
'd7_field_instance',
]);
}
protected function migrateContentTypes() {
parent::migrateContentTypes();
$this
->installEntitySchema('commerce_product');
$this
->installEntitySchema('commerce_product_variation');
$this
->installConfig([
'commerce_product',
]);
$this
->executeMigrations([
'uc7_product_variation_type',
'uc7_product_type',
]);
}
protected function migrateOrderItems() {
$this
->installEntitySchema('commerce_order');
$this
->installEntitySchema('commerce_order_item');
$this
->installEntitySchema('commerce_product');
$this
->installEntitySchema('commerce_product_variation');
$this
->installEntitySchema('profile');
$this
->migrateStore();
$this
->installSchema('commerce_number_pattern', [
'commerce_number_pattern_sequence',
]);
$this
->installConfig([
'commerce_order',
'commerce_product',
]);
$this
->migrateContentTypes();
$this
->migrateAttributes();
$this
->executeMigrations([
'uc7_product_variation',
'd7_node',
'uc7_profile_billing',
'uc7_order_product',
]);
}
protected function migrateOrders() {
$this
->installEntitySchema('commerce_order');
$this
->installEntitySchema('commerce_order_item');
$this
->installEntitySchema('commerce_product');
$this
->installEntitySchema('commerce_product_variation');
$this
->installEntitySchema('profile');
$this
->migrateOrderItems();
$this
->executeMigration('uc_order_field');
$this
->executeMigration('uc_order_field_instance');
$this
->executeMigration('uc7_order');
}
protected function migrateProducts() {
$this
->installEntitySchema('commerce_product');
$this
->installEntitySchema('path_alias');
$this
->installConfig(static::$modules);
$this
->migrateStore();
$this
->migrateContentTypes();
$this
->migrateFields();
$this
->migrateCommentTypes();
$this
->executeMigrations([
'uc_attribute_field',
'uc_product_attribute',
'uc_attribute_field_instance',
'uc7_product_variation',
'd7_node',
]);
}
protected function migrateProductVariations() {
$this
->installEntitySchema('node');
$this
->installEntitySchema('view');
$this
->installEntitySchema('commerce_product_variation');
$this
->installEntitySchema('commerce_product');
$this
->installConfig(static::$modules);
$this
->migrateStore();
$this
->migrateUsers(FALSE);
$this
->executeMigrations([
'd7_taxonomy_vocabulary',
'd7_comment_type',
'd7_comment_field',
'uc7_comment_type',
'uc7_comment_field',
'd7_field',
'uc_attribute_field',
'uc_product_attribute',
'uc_attribute_field_instance',
'd7_node_type',
'uc7_product_type',
'uc7_product_variation_type',
'uc7_product_variation',
]);
}
protected function migrateStore() {
$this
->installEntitySchema('commerce_store');
$this
->migrateUsers(FALSE);
$this
->executeMigrations([
'uc_currency',
'uc7_store',
]);
}
}