public function AddToCartFormTest::testProductAddToCartFormValidations in Commerce Core 8.2
Test adding an unavailable product to the cart.
File
- modules/
cart/ tests/ src/ Functional/ AddToCartFormTest.php, line 52
Class
- AddToCartFormTest
- Tests the add to cart form.
Namespace
Drupal\Tests\commerce_cart\FunctionalCode
public function testProductAddToCartFormValidations() {
$this->variation
->setSku('TEST_SKU1234')
->save();
// Confirm that the initial add to cart submit works.
$this
->postAddToCart($this->variation
->getProduct());
$this->cart = Order::load($this->cart
->id());
$order_items = $this->cart
->getItems();
$this
->assertCount(0, $order_items);
$this
->assertSession()
->pageTextContains(sprintf('%s is not available with a quantity of %s.', $this->variation
->label(), 1));
}