public function ProductTest::testProduct in Commerce Migrate 3.0.x
Same name in this branch
- 3.0.x modules/csv_example/tests/src/Kernel/Migrate/ProductTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ProductTest::testProduct()
- 3.0.x modules/magento/tests/src/Kernel/Migrate/magento2/ProductTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductTest::testProduct()
- 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductTest::testProduct()
- 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductTest::testProduct()
- 3.0.x modules/commerce/tests/src/Kernel/Migrate/commerce1/ProductTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\ProductTest::testProduct()
Same name and namespace in other branches
- 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductTest::testProduct()
- 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductTest::testProduct()
Test product migration.
1 method overrides ProductTest::testProduct()
- ProductRollbackTest::testProduct in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ ProductRollbackTest.php - Test product migration rollback.
File
- modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ ProductTest.php, line 51
Class
- ProductTest
- Tests Product migration.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7Code
public function testProduct() {
$this
->assertProductEntity(1, 'product', '1', 'Breshtanti ale', TRUE, [
'1',
], [
'1',
]);
$variation = [
'id' => 1,
'type' => 'product',
'uid' => '1',
'sku' => 'drink-001',
'price' => '50.000000',
'currency' => 'USD',
'product_id' => '1',
'title' => 'Breshtanti ale',
'order_item_type_id' => 'default',
'created_time' => '1493289860',
'changed_time' => NULL,
'attributes' => NULL,
];
$this
->assertProductVariationEntity($variation);
$product = Product::load(1);
$this
->assertEquals("Favored by all.", $product->body->value);
$this
->assertEquals("4", $product->field_number->value);
$this
->assertEquals("High", $product->field_sustainability->value);
$this
->assertProductEntity(2, 'product', '1', 'Romulan ale', TRUE, [
'1',
], [
'2',
]);
$variation = [
'id' => 2,
'type' => 'product',
'uid' => '1',
'sku' => 'drink-002',
'price' => '100.000000',
'currency' => 'USD',
'product_id' => '2',
'title' => 'Romulan ale',
'order_item_type_id' => 'default',
'created_time' => '1493326300',
'changed_time' => NULL,
'attributes' => NULL,
];
$this
->assertProductVariationEntity($variation);
$product = Product::load(2);
$this
->assertEquals("Renowned", $product->body->value);
$this
->assertProductEntity(3, 'entertainment', '1', 'Holosuite 1', TRUE, [
'1',
], [
'3',
]);
$variation = [
'id' => 3,
'type' => 'entertainment',
'uid' => '1',
'sku' => 'Holosuite-001',
'price' => '40.000000',
'currency' => 'USD',
'product_id' => '3',
'title' => 'Holosuite 1',
'order_item_type_id' => 'default',
'created_time' => '1493326429',
'changed_time' => NULL,
'attributes' => NULL,
];
$this
->assertProductVariationEntity($variation);
// There is only one node in the fixture that is not a product, node 4.
$node = Node::load(4);
$this
->assertInstanceOf(Node::class, $node, "Node 4 exists.");
// Nodes 1, 2 and 3 should not exist.
$nodes = [
1,
2,
3,
];
foreach ($nodes as $node) {
$node = Node::load($node);
$this
->assertNull($node, "Node {$node} exists.");
}
}