public function CartCheckoutTest::testDeletedCartItem in Ubercart 8.4
Tests that cart automatically removes products that have been deleted.
File
- uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php, line 228
Class
- CartCheckoutTest
- Tests the cart and checkout functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testDeletedCartItem() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Add a product to the cart, then delete the node.
$this
->addToCart($this->product);
$this->product
->delete();
// Test that the cart is empty.
$this
->drupalGet('cart');
$assert
->pageTextContains('There are no products in your shopping cart.');
$this
->assertSame([], $this->cart
->getContents(), 'There are no items in the cart.');
}