Ejemplo n.º 1
0
 public function testRepresentProductTrue()
 {
     $productMock = $this->generateProductMock(self::PRODUCT_ID, self::PRODUCT_TYPE, self::PRODUCT_SKU, self::PRODUCT_NAME, self::PRODUCT_WEIGHT, self::PRODUCT_TAX_CLASS_ID, self::PRODUCT_COST);
     $parentItemMock = $this->getMockBuilder('Magento\\Quote\\Model\\Quote\\Item')->setMethods(['addChild', '__wakeup'])->disableOriginalConstructor()->getMock();
     $this->model->setProduct($productMock);
     $this->model->setParentItem($parentItemMock);
     $optionCode1 = 1234;
     $optionMock1 = $this->createOptionMock($optionCode1);
     $optionMock1->expects($this->any())->method('getValue')->will($this->returnValue(1234));
     $optionCode2 = 7890;
     $optionMock2 = $this->createOptionMock($optionCode2);
     $optionMock2->expects($this->any())->method('getValue')->will($this->returnValue(7890));
     $this->model->setOptions([$optionMock1, $optionMock2]);
     $productMock->expects($this->once())->method('getStickWithinParent')->will($this->returnValue($parentItemMock));
     $productMock->expects($this->once())->method('getCustomOptions')->will($this->returnValue([$optionCode1 => $optionMock1, $optionCode2 => $optionMock2]));
     $this->assertTrue($this->model->representProduct($productMock));
 }