Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
CartTest Class Reference
Inheritance diagram for CartTest:

Public Member Functions

 testAddProductWithLowerQty ()
 
 testAddProductWithNoQty ()
 

Protected Member Functions

 setUp ()
 

Detailed Description

Definition at line 11 of file CartTest.php.

Member Function Documentation

◆ setUp()

setUp ( )
protected

Definition at line 23 of file CartTest.php.

24  {
25  $this->cart = Bootstrap::getObjectManager()->create(Cart::class);
26  $this->productRepository = Bootstrap::getObjectManager()->create(ProductRepositoryInterface::class);
27  }

◆ testAddProductWithLowerQty()

testAddProductWithLowerQty ( )

@magentoDataFixture Magento/Checkout/_files/simple_product.php @magentoDataFixture Magento/Checkout/_files/set_product_min_in_cart.php @magentoDbIsolation enabled @magentoAppIsolation enabled

Definition at line 35 of file CartTest.php.

36  {
37  $this->expectException(\Magento\Framework\Exception\LocalizedException::class);
38  $this->expectExceptionMessage('The fewest you may purchase is 3');
39  $product = $this->productRepository->get('simple');
40  $this->cart->addProduct($product->getId(), ['qty' => 1]);
41  }

◆ testAddProductWithNoQty()

testAddProductWithNoQty ( )

@magentoDataFixture Magento/Checkout/_files/simple_product.php @magentoDataFixture Magento/Checkout/_files/set_product_min_in_cart.php @magentoDbIsolation enabled

Definition at line 48 of file CartTest.php.

49  {
50  $product = $this->productRepository->get('simple');
51  $this->cart->addProduct($product->getId(), []);
52  }

The documentation for this class was generated from the following file: