/**
  * Run Unassign Custom OrderStatus test.
  *
  * @param OrderStatus $orderStatus
  * @return void
  */
 public function test(OrderStatus $orderStatus)
 {
     // Preconditions:
     $orderStatus->persist();
     // Steps:
     $orderStatusLabel = $orderStatus->getLabel();
     $this->orderStatusIndex->open();
     $this->orderStatusIndex->getOrderStatusGrid()->searchAndUnassign(['label' => $orderStatusLabel]);
 }
 /**
  * Assert order status availability in Order Status grid
  *
  * @param OrderStatus $orderStatus
  * @param OrderStatusIndex $orderStatusIndexPage
  * @param string|null $defaultState
  * @return void
  */
 public function processAssert(OrderStatus $orderStatus, OrderStatusIndex $orderStatusIndexPage, $defaultState = null)
 {
     $orderStatusIndexPage->open();
     $orderStatusLabel = $orderStatus->getLabel();
     $filter = ['status' => $orderStatus->getStatus(), 'label' => $orderStatusLabel];
     if ($defaultState !== null) {
         $state = $this->prepareState($orderStatus->getState());
         $filter = ['label' => $defaultState, 'state' => $state];
     }
     \PHPUnit_Framework_Assert::assertTrue($orderStatusIndexPage->getOrderStatusGrid()->isRowVisible($filter, true, false), 'Order status \'' . $orderStatusLabel . '\' is absent in Order Status grid.');
 }
 /**
  * Change created order status and unassign custom order status if order was created.
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->order->hasData('id')) {
         $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel');
         $filter = ['label' => $this->orderStatus->getLabel(), 'status' => $this->orderStatusInitial->getStatus()];
         $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter);
     }
 }
 /**
  * Change created order status and unassign custom order status if order was created.
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->order->hasData('id')) {
         $this->orderIndex->open()->getSalesOrderGrid()->massaction([['id' => $this->order->getId()]], 'Cancel');
         $filter = ['label' => $this->orderStatus->getLabel(), 'status' => $this->orderStatusInitial->getStatus()];
         $this->orderStatusIndex->open()->getOrderStatusGrid()->searchAndUnassign($filter);
         $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'checkmo_custom_new_order_status_rollback'])->run();
     }
 }
 /**
  * Assert that order status with status code from fixture have empty "State Code and Title" value
  *
  * @param OrderStatus $orderStatus
  * @param OrderStatusIndex $orderStatusIndex
  * @return void
  */
 public function processAssert(OrderStatus $orderStatus, OrderStatusIndex $orderStatusIndex)
 {
     $statusLabel = $orderStatus->getLabel();
     \PHPUnit_Framework_Assert::assertFalse($orderStatusIndex->open()->getOrderStatusGrid()->isRowVisible(['label' => $statusLabel, 'state' => $orderStatus->getState()]), "Order status {$statusLabel} is assigned to state.");
 }