Example #1
0
 /**
  * Test for method unassignState status in use
  *
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage Status can't be unassigned, because it is used by existing order(s).
  */
 public function testUnassignStateStatusUsed()
 {
     $params = ['status' => $this->model->getStatus(), 'state' => 'test_state'];
     $this->resourceMock->expects($this->once())->method('checkIsStateLast')->with($this->equalTo($params['state']))->will($this->returnValue(false));
     $this->resourceMock->expects($this->once())->method('checkIsStatusUsed')->with($this->equalTo($params['status']))->will($this->returnValue(true));
     $this->assertEquals($this->model, $this->model->unassignState($params['state']));
 }
Example #2
0
 /**
  * Decorate values to column
  *
  * @param string $value
  * @param \Magento\Sales\Model\Order\Status $row
  * @param \Magento\Backend\Block\Widget\Grid\Column $column
  * @param bool $isExport
  * @return string
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function decorateAction($value, $row, $column, $isExport)
 {
     $cell = '';
     $state = $row->getState();
     if (!empty($state)) {
         $url = $this->getUrl('*/*/unassign', ['status' => $row->getStatus(), 'state' => $row->getState()]);
         $label = __('Unassign');
         $cell = '<a href="' . $url . '">' . $label . '</a>';
     }
     return $cell;
 }
Example #3
0
 /**
  * Store labels getter
  *
  * @param \Magento\Sales\Model\Order\Status $status
  * @return array
  */
 public function getStoreLabels(\Magento\Sales\Model\Order\Status $status)
 {
     $select = $this->_getWriteAdapter()->select()->from(['ssl' => $this->labelsTable], [])->where('status = ?', $status->getStatus())->columns(['store_id', 'label']);
     return $this->_getReadAdapter()->fetchPairs($select);
 }