You are here

public function OrderReassignTest::testReassignToExistingUser in Commerce Core 8.2

Tests the reassign form with an existing user.

File

modules/order/tests/src/FunctionalJavascript/OrderReassignTest.php, line 88

Class

OrderReassignTest
Tests the commerce_order reassign form.

Namespace

Drupal\Tests\commerce_order\FunctionalJavascript

Code

public function testReassignToExistingUser() {
  $another_user = $this
    ->createUser();
  $this
    ->drupalGet($this->order
    ->toUrl('reassign-form'));
  $this
    ->submitForm([
    'uid' => $another_user
      ->getAccountName(),
  ], 'Reassign order');
  $collection_url = $this->order
    ->toUrl('collection', [
    'absolute' => TRUE,
  ]);
  $this
    ->assertSession()
    ->addressEquals($collection_url);
  $this
    ->assertSession()
    ->pageTextContains(t('has been assigned to customer @customer.', [
    '@customer' => $another_user
      ->getAccountName(),
  ]));
  $this->order = $this
    ->reloadEntity($this->order);
  $this
    ->assertEquals($another_user
    ->id(), $this->order
    ->getCustomerId());
}