You are here

public function OrderAdminTest::testCreateOrder in Commerce Core 8.2

Same name in this branch
  1. 8.2 modules/log/tests/src/Functional/OrderAdminTest.php \Drupal\Tests\commerce_log\Functional\OrderAdminTest::testCreateOrder()
  2. 8.2 modules/order/tests/src/FunctionalJavascript/OrderAdminTest.php \Drupal\Tests\commerce_order\FunctionalJavascript\OrderAdminTest::testCreateOrder()

Tests creating an order.

File

modules/log/tests/src/Functional/OrderAdminTest.php, line 75

Class

OrderAdminTest
Tests the order admin.

Namespace

Drupal\Tests\commerce_log\Functional

Code

public function testCreateOrder() {

  // Create an order through the add form.
  $this
    ->drupalGet('/admin/commerce/orders');
  $this
    ->getSession()
    ->getPage()
    ->clickLink('Create a new order');
  $user = $this->loggedInUser
    ->getAccountName() . ' (' . $this->loggedInUser
    ->id() . ')';
  $edit = [
    'customer_type' => 'existing',
    'uid' => $user,
  ];
  $this
    ->submitForm($edit, t('Create'));
  $order = Order::load(1);
  $this
    ->drupalGet($order
    ->toUrl('canonical'));
  $this
    ->assertSession()
    ->pageTextContains('Order created through the order add form.');
}