You are here

public function OrderTest::testUbercartOrder in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/OrderTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\OrderTest::testUbercartOrder()
  2. 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc7/OrderTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\OrderTest::testUbercartOrder()

Test order migration.

File

modules/ubercart/tests/src/Kernel/Migrate/uc7/OrderTest.php, line 52

Class

OrderTest
Tests order migration.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7

Code

public function testUbercartOrder() {
  $order = [
    'id' => 1,
    'type' => 'default',
    'number' => '1',
    'store_id' => '1',
    'created_time' => '1493326662',
    'changed_time' => '1536901828',
    'completed_time' => NULL,
    'email' => 'tomparis@example.com',
    'ip_address' => '172.19.0.2',
    'customer_id' => '2',
    'placed_time' => '1536901828',
    'total_price' => '107.000000',
    'total_price_currency' => 'USD',
    'label_value' => 'validation',
    'label_rendered' => 'validation',
    'order_items_ids' => [
      '1',
    ],
    'billing_profile' => [
      '1',
      '1',
    ],
    'cart' => NULL,
    'data' => [],
    'adjustments' => [
      new Adjustment([
        'type' => 'custom',
        'label' => 'Shipping',
        'amount' => new Price('2', 'USD'),
        'percentage' => NULL,
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ]),
    ],
    'order_admin_comments' => [
      [
        'value' => 'Order created through website.',
      ],
      [
        'value' => 'Admin comment 1',
      ],
      [
        'value' => 'Admin comment 2',
      ],
    ],
    'order_comments' => [],
    'order_logs' => [
      0 => [
        'value' => "Added \$5.00 for Station maintenance.\n",
      ],
      1 => [
        'value' => "Order status changed from In checkout to Pending.\n",
      ],
      2 => [
        'value' => "delivery_street1 changed from Level 12 to .\ndelivery_city changed from USS Voyager to San Fransisco.\ndelivery_zone changed from 66 to 12.\ndelivery_country changed from 124 to 840.\nbilling_street1 changed from Level 12 to .\nbilling_city changed from Montgomery to San Fransisco.\nbilling_postal_code changed from 1234 to 74656.\n",
      ],
      3 => [
        'value' => "COD payment for \$50.00 entered.\n",
      ],
      4 => [
        'value' => "COD payment for -\$40.00 entered.\n",
      ],
      5 => [
        'value' => "Free order payment for \$60.00 entered.\n",
      ],
      6 => [
        'value' => "Free order payment for \$60.00 deleted.\n",
      ],
      7 => [
        'value' => "COD payment for \$53.00 entered.\n",
      ],
      8 => [
        'value' => "COD payment for -\$60.00 entered.\n",
      ],
    ],
  ];
  $this
    ->assertUbercartOrder($order);
  $order = [
    'id' => 2,
    'type' => 'default',
    'number' => '2',
    'store_id' => '1',
    'created_time' => '1536901552',
    'changed_time' => '1550193053',
    'completed_time' => '1550193053',
    'email' => 'harrykim@example.com',
    'label' => 'completed',
    'ip_address' => '172.19.0.2',
    'customer_id' => '4',
    'placed_time' => '1550193053',
    'total_price' => '420.400000',
    'total_price_currency' => 'USD',
    'label_value' => 'completed',
    'label_rendered' => 'Completed',
    'order_items_ids' => [
      '2',
      '3',
    ],
    'billing_profile' => [
      '2',
      '2',
    ],
    'cart' => NULL,
    'data' => [],
    'adjustments' => [],
    'order_admin_comments' => [
      [
        'value' => 'Order created by the administration.',
      ],
    ],
    'order_comments' => [],
    'order_logs' => [
      0 => [
        'value' => "Added (1) Romulan ale to order.\n",
      ],
      1 => [
        'value' => "order_total changed from 100.1 to 0.\nproduct_count changed from 1 to 0.\ndelivery_zone changed from 0 to 0.\nbilling_zone changed from 0 to 0.\npayment_method changed from  to free_order.\n",
      ],
      2 => [
        'value' => "delivery_first_name changed from  to Tom.\ndelivery_last_name changed from  to Paris.\ndelivery_city changed from  to San Fransisco.\ndelivery_zone changed from 0 to 12.\ndelivery_country changed from 124 to 840.\nbilling_first_name changed from  to Tom.\nbilling_last_name changed from  to Paris.\nbilling_city changed from  to San Fransisco.\nbilling_zone changed from 0 to 0.\nbilling_country changed from 124 to 840.\npayment_method changed from free_order to cod.\n",
      ],
      3 => [
        'value' => "Added (1) Holosuite 1 to order.\n",
      ],
      4 => [
        'value' => "order_total changed from 140.1 to 100.1.\nproduct_count changed from 2 to 1.\nprimary_email changed from tomparis@example.com to harrykim@example.com.\ndelivery_first_name changed from Tom to Harry.\ndelivery_last_name changed from Paris to Kim.\nbilling_first_name changed from Tom to Harry.\nbilling_last_name changed from Paris to Kim.\nbilling_zone changed from 0 to 12.\n",
      ],
      5 => [
        'value' => "uid changed from 2 to 4.\n",
      ],
      6 => [
        'value' => "billing_street1 changed from  to 33 First Street.\n",
      ],
      7 => [
        'value' => "COD payment for \$400.00 entered.\n",
      ],
      8 => [
        'value' => "COD payment for \$40.40 entered.\n",
      ],
      9 => [
        'value' => "Order status changed from Pending to Payment received.\n",
      ],
      10 => [
        'value' => "modified changed from 1550193050 to 1550193050.\n",
      ],
    ],
  ];
  $this
    ->assertUbercartOrder($order);
  $order = [
    'id' => 3,
    'type' => 'default',
    'number' => '3',
    'store_id' => '1',
    'created_time' => '1536902338',
    'changed_time' => '1536964646',
    'completed_time' => NULL,
    'email' => 'tomparis@example.com',
    'label' => 'completed',
    'ip_address' => '172.19.0.2',
    'customer_id' => '2',
    'placed_time' => '1536964646',
    'total_price' => NULL,
    'total_price_currency' => 'USD',
    'label_value' => 'validation',
    'label_rendered' => 'validation',
    'order_items_ids' => [],
    'billing_profile' => [
      '1',
      '3',
    ],
    'cart' => NULL,
    'data' => [],
    'adjustments' => [],
    'order_admin_comments' => [
      [
        'value' => 'Order created by the administration.',
      ],
    ],
    'order_comments' => [],
    'order_logs' => [
      0 => [
        'value' => "delivery_first_name changed from  to Tom.\ndelivery_last_name changed from  to Paris.\ndelivery_street1 changed from  to Level 12.\ndelivery_city changed from  to Starship Voyager.\ndelivery_zone changed from 0 to 0.\nbilling_first_name changed from  to Harry.\nbilling_last_name changed from  to Kim.\nbilling_zone changed from 0 to 12.\nbilling_country changed from 124 to 840.\npayment_method changed from  to free_order.\n",
      ],
      1 => [
        'value' => "delivery_zone changed from 0 to 0.\nbilling_street1 changed from  to 11 Somewhere St.\nbilling_city changed from  to San Fransisco.\n",
      ],
      2 => [
        'value' => "delivery_zone changed from 0 to 0.\nbilling_first_name changed from Harry to Tom.\nbilling_last_name changed from Kim to Paris.\nbilling_street1 changed from 11 Somewhere St to Level 12.\nbilling_city changed from San Fransisco to Starship Voyager.\nbilling_zone changed from 12 to 0.\nbilling_country changed from 840 to 124.\n",
      ],
    ],
  ];
  $this
    ->assertUbercartOrder($order);
  $order = [
    'id' => 4,
    'type' => 'default',
    'number' => '4',
    'store_id' => '1',
    'created_time' => '1536902428',
    'changed_time' => '1536902428',
    'completed_time' => NULL,
    'email' => 'harrykim@example.com',
    'label' => 'completed',
    'ip_address' => '127.0.0.1',
    'customer_id' => '4',
    'placed_time' => '1536902428',
    'total_price' => '50.500000',
    'total_price_currency' => 'USD',
    'label_value' => 'validation',
    'label_rendered' => 'validation',
    'order_items_ids' => [
      '4',
    ],
    'billing_profile' => [
      '2',
      '4',
    ],
    'cart' => NULL,
    'data' => [],
    'adjustments' => [],
    'order_admin_comments' => [
      [
        'value' => 'Order created by the administration.',
      ],
    ],
    'order_comments' => [],
    'order_logs' => [
      0 => [
        'value' => "Added (1) Breshtanti ale to order.\n",
      ],
    ],
  ];
  $this
    ->assertUbercartOrder($order);
  $order = [
    'id' => 5,
    'type' => 'default',
    'number' => '5',
    'store_id' => '1',
    'created_time' => '1544757659',
    'changed_time' => '1550192249',
    'completed_time' => NULL,
    'email' => 'root@example.com',
    'label' => 'completed',
    'ip_address' => '172.19.0.2',
    'customer_id' => '1',
    'placed_time' => '1550192249',
    'total_price' => '477.500000',
    'total_price_currency' => 'USD',
    'label_value' => 'validation',
    'label_rendered' => 'validation',
    'order_items_ids' => [
      '5',
      '6',
      '7',
    ],
    'billing_profile' => [
      '3',
      '5',
    ],
    'cart' => NULL,
    'data' => [],
    'adjustments' => [
      new Adjustment([
        'type' => 'custom',
        'label' => 'Shipping',
        'amount' => new Price('9.5', 'USD'),
        'percentage' => NULL,
        'source_id' => 'custom',
        'included' => FALSE,
        'locked' => TRUE,
      ]),
    ],
  ];
  $this
    ->assertUbercartOrder($order);
}