Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UnholdAndCancelOrderStep.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\TestStep\TestStepFactory;
9 use Magento\Mtf\TestStep\TestStepInterface;
13 
17 class UnholdAndCancelOrderStep implements TestStepInterface
18 {
24  private $placeOrderStatus;
25 
31  private $order;
32 
38  private $testStepFactory;
39 
45  public function __construct(
46  $placeOrderStatus,
47  OrderInjectable $order,
48  TestStepFactory $testStepFactory
49  ) {
50  $this->placeOrderStatus = $placeOrderStatus;
51  $this->order = $order;
52  $this->testStepFactory = $testStepFactory;
53  }
54 
62  public function run()
63  {
64  if ($this->placeOrderStatus === 'On Hold') {
65  $this->getStepInstance(UnholdOrderStep::class)->run();
66  }
67 
68  $this->getStepInstance(CancelOrderStep::class)->run();
69  }
70 
77  private function getStepInstance($class)
78  {
79  return $this->testStepFactory->create(
80  $class,
81  ['order' => $this->order]
82  );
83  }
84 }
$order
Definition: order.php:55
$_option $_optionId $class
Definition: date.phtml:13
__construct( $placeOrderStatus, OrderInjectable $order, TestStepFactory $testStepFactory)