Ejemplo n.º 1
0
 /**
  * test compare two items first without options and second with options
  */
 public function testCompareItemWithoutOptionWithCompared()
 {
     $this->itemMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->comparedMock->expects($this->any())->method('getProductId')->will($this->returnValue(1));
     $this->comparedMock->expects($this->any())->method('getOptions')->will($this->returnValue([$this->getOptionMock('option-1', 1), $this->getOptionMock('option-2', 'option-value'), $this->getOptionMock('option-3', serialize(['value' => 'value-1', 'qty' => 2]))]));
     $this->itemMock->expects($this->any())->method('getOptions')->will($this->returnValue([]));
     $this->assertFalse($this->helper->compare($this->itemMock, $this->comparedMock));
 }
Ejemplo n.º 2
0
 /**
  * test compare
  */
 public function testCompare()
 {
     $itemMock = $this->getMock('Magento\\Sales\\Model\\Quote\\Item', [], [], '', false);
     $this->compareHelper->expects($this->once())->method('compare')->with($this->equalTo($this->model), $this->equalTo($itemMock))->will($this->returnValue(true));
     $this->assertTrue($this->model->compare($itemMock));
 }
Ejemplo n.º 3
0
 /**
  * Compare items
  *
  * @param   \Magento\Sales\Model\Quote\Item $item
  * @return  bool
  */
 public function compare($item)
 {
     return $this->_compareHelper->compare($this, $item);
 }