/** * Tests that adding a quantity to an item with a parent item and an id will not change the quantity. */ public function testAddQtyExistingParentItemAndId() { $existingQuantity = 2; $quantityToAdd = 3; $parentItemMock = $this->getMockBuilder('Magento\\Sales\\Model\\Quote\\Item')->setMethods(['addChild', '__wakeup'])->disableOriginalConstructor()->getMock(); $this->model->setParentItem($parentItemMock); $this->model->setId(1); $this->model->setData('qty', $existingQuantity); $this->model->addQty($quantityToAdd); $this->assertEquals($existingQuantity, $this->model->getQty()); $this->assertNull($this->model->getQtyToAdd()); }