cart = $this->_objectManager->get(Cart::class); $this->formKey = $this->_objectManager->get(FormKey::class); } /** * Test that Quote totals are updated correctly when 'Multishipping' mode is enabled. * * @magentoDataFixture Magento/Catalog/_files/products.php * @return void */ public function testPluginWithEnabledMultishippingMode(): void { $quote = $this->cart->getQuote(); $postData = [ 'qty' => '1', 'product' => '1', ]; $this->getRequest()->setPostValue($postData) ->setMethod(HttpRequest::METHOD_POST) ->setParam('form_key', $this->formKey->getFormKey()); $this->dispatch('checkout/cart/add'); $this->assertEquals(1, (int)$quote->getItemsQty()); $quote->setTotalsCollectedFlag(false) ->setIsMultiShipping(true); $this->dispatch('checkout/cart/add'); $this->assertEquals(2, (int)$quote->getItemsQty()); $this->assertEquals(0, $quote->getIsMultiShipping()); } }