Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SignifydCancelOrderStep.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\TestStep\TestStepFactory;
9 use Magento\Mtf\TestStep\TestStepInterface;
11 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
12 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
16 
20 class SignifydCancelOrderStep implements TestStepInterface
21 {
27  private $orderIndex;
28 
34  private $order;
35 
41  private $salesOrderView;
42 
48  private $testStepFactory;
49 
56  public function __construct(
57  OrderIndex $orderIndex,
58  OrderInjectable $order,
59  SalesOrderView $salesOrderView,
60  TestStepFactory $testStepFactory
61  ) {
62  $this->orderIndex = $orderIndex;
63  $this->order = $order;
64  $this->salesOrderView = $salesOrderView;
65  $this->testStepFactory = $testStepFactory;
66  }
67 
71  public function run()
72  {
73  $this->orderIndex->open();
74  $this->orderIndex->getSalesOrderGrid()
75  ->searchAndOpen(['id' => $this->order->getId()]);
76 
77  switch ($this->salesOrderView->getOrderInfoBlock()->getOrderStatus()) {
78  case 'Suspected Fraud':
79  $this->getStepInstance(DenyPaymentStep::class)->run();
80  break;
81  case 'On Hold':
82  $this->getStepInstance(UnholdOrderStep::class)->run();
83  $this->getStepInstance(CancelOrderStep::class)->run();
84  break;
85  case 'Canceled':
86  break;
87  default:
88  $this->getStepInstance(CancelOrderStep::class)->run();
89  }
90  }
91 
98  private function getStepInstance($class)
99  {
100  return $this->testStepFactory->create(
101  $class,
102  ['order' => $this->order]
103  );
104  }
105 }
$order
Definition: order.php:55
$_option $_optionId $class
Definition: date.phtml:13
__construct(OrderIndex $orderIndex, OrderInjectable $order, SalesOrderView $salesOrderView, TestStepFactory $testStepFactory)