Пример #1
0
 /**
  * Test for method unassignState status in use
  *
  * @expectedException \Magento\Framework\Model\Exception
  * @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']));
 }
Пример #2
0
 public function testAssignState()
 {
     $state = 'processing';
     $status = 'processing';
     $isDefault = 1;
     $visibleOnFront = 1;
     $tableName = 'sales_order_status_state';
     $this->adapterMock->expects($this->once())->method('update')->with($this->equalTo($tableName), $this->equalTo(['is_default' => 0]), $this->equalTo(['state = ?' => $state]));
     $this->adapterMock->expects($this->once())->method('insertOnDuplicate')->with($this->equalTo($tableName), $this->equalTo(['status' => $status, 'state' => $state, 'is_default' => $isDefault, 'visible_on_front' => $visibleOnFront]));
     $this->model->assignState($status, $state, $isDefault, $visibleOnFront);
 }
Пример #3
0
 /**
  * @magentoDataFixture Magento/Sales/_files/assign_status_to_state.php
  */
 public function testUnassignState()
 {
     $this->resourceModel->unassignState('fake_status_do_not_use_it', 'fake_state_do_not_use_it');
     $this->assertTrue(true);
     $this->assertFalse((bool) $this->resourceModel->getReadConnection()->fetchOne($this->resourceModel->getReadConnection()->select()->from($this->resourceModel->getTable('sales_order_status_state'), [new \Zend_Db_Expr(1)])->where('status = ?', 'fake_status_do_not_use_it')->where('state = ?', 'fake_state_do_not_use_it')));
 }