Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CancelCreatedOrderTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
11 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
12 use Magento\Mtf\TestCase\Injectable;
13 use Magento\Mtf\TestStep\TestStepFactory;
14 
31 class CancelCreatedOrderTest extends Injectable
32 {
33  /* tags */
34  const MVP = 'yes';
35  /* end tags */
36 
42  protected $orderIndex;
43 
49  protected $salesOrderView;
50 
56  private $configData;
57 
65  public function __inject(OrderIndex $orderIndex, SalesOrderView $salesOrderView)
66  {
67  $this->orderIndex = $orderIndex;
68  $this->salesOrderView = $salesOrderView;
69  }
70 
79  public function test(OrderInjectable $order, TestStepFactory $stepFactory, $configData)
80  {
81  // Preconditions
82  $this->configData = $configData;
83  $stepFactory->create(
84  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
85  ['configData' => $configData]
86  )->run();
87  $order->persist();
88 
89  // Steps
90  $this->orderIndex->open();
91  $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
92  $this->salesOrderView->getPageActions()->cancel();
93 
94  return [
95  'customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(),
96  ];
97  }
98 
104  public function tearDown()
105  {
106  $this->objectManager->create(
107  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
108  ['configData' => $this->configData, 'rollback' => true]
109  )->run();
110  }
111 }
test(OrderInjectable $order, TestStepFactory $stepFactory, $configData)
$order
Definition: order.php:55
__inject(OrderIndex $orderIndex, SalesOrderView $salesOrderView)