Exemple #1
0
 /**
  * Test method refreshByOrderId()
  */
 public function testRefreshByOrderId()
 {
     $orderId = 1;
     $this->orderGridMock->expects($this->once())->method('refresh')->with($this->equalTo($orderId), $this->equalTo('sfo.entity_id'))->will($this->returnValue($this->statementMock));
     $this->invoiceGridMock->expects($this->once())->method('refresh')->with($this->equalTo($orderId), $this->equalTo('sfo.entity_id'))->will($this->returnValue($this->statementMock));
     $this->shipmentGridMock->expects($this->once())->method('refresh')->with($this->equalTo($orderId), $this->equalTo('sfo.entity_id'))->will($this->returnValue($this->statementMock));
     $this->creditmemoGridMock->expects($this->once())->method('refresh')->with($this->equalTo($orderId), $this->equalTo('sfo.entity_id'))->will($this->returnValue($this->statementMock));
     $this->assertEquals($this->gridPool, $this->gridPool->refreshByOrderId($orderId));
 }
Exemple #2
0
 /**
  * Update related grid table after object save
  *
  * @param \Magento\Framework\Model\AbstractModel|\Magento\Framework\Object $object
  * @return \Magento\Framework\Model\Resource\Db\AbstractDb
  */
 protected function _afterSave(\Magento\Framework\Model\AbstractModel $object)
 {
     $resource = parent::_afterSave($object);
     if ($object->getOrderId()) {
         $this->gridPool->refreshByOrderId($object->getOrderId());
     }
     return $resource;
 }