You are here

public function OrderAdminTest::testUnlockOrder in Commerce Core 8.2

Tests unlocking an order.

File

modules/order/tests/src/FunctionalJavascript/OrderAdminTest.php, line 340

Class

OrderAdminTest
Tests the order admin UI.

Namespace

Drupal\Tests\commerce_order\FunctionalJavascript

Code

public function testUnlockOrder() {
  $order = $this
    ->createEntity('commerce_order', [
    'type' => 'default',
    'mail' => $this->loggedInUser
      ->getEmail(),
    'uid' => $this->loggedInUser,
    'store_id' => $this->store,
    'locked' => TRUE,
  ]);
  $this
    ->drupalGet($order
    ->toUrl('unlock-form'));
  $this
    ->assertSession()
    ->pageTextContains(t('Are you sure you want to unlock the order @label?', [
    '@label' => $order
      ->label(),
  ]));
  $this
    ->submitForm([], t('Unlock'));
  $this->container
    ->get('entity_type.manager')
    ->getStorage('commerce_order')
    ->resetCache([
    $order
      ->id(),
  ]);
  $order = Order::load($order
    ->id());
  $this
    ->assertFalse($order
    ->isLocked());
}