You are here

public function CartTest::testLockedOrderItems in Commerce Core 8.2

Tests the cart page with a locked order item.

File

modules/cart/tests/src/Functional/CartTest.php, line 178

Class

CartTest
Tests the cart page.

Namespace

Drupal\Tests\commerce_cart\Functional

Code

public function testLockedOrderItems() {
  $this->cartManager
    ->emptyCart($this->cart);
  $order_item = $this->cartManager
    ->createOrderItem($this->variations[0], 2);
  $order_item
    ->lock();
  $this->cartManager
    ->addOrderItem($this->cart, $order_item);

  // Check that the order item is displayed, and the quantity form element and
  // the Remove button are not displayed.
  $this
    ->drupalGet('cart');
  $this
    ->assertSession()
    ->pageTextContains('$999.00');
  $this
    ->assertSession()
    ->elementContains('css', '#edit-edit-quantity-0', '2');
  $this
    ->assertSession()
    ->fieldNotExists('edit-edit-quantity-0');
  $this
    ->assertSession()
    ->buttonNotExists('Remove');
}