Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SalesRefundsReportEntityTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Fixture\FixtureFactory;
10 use Magento\Mtf\TestCase\Injectable;
11 use Magento\Reports\Test\Page\Adminhtml\RefundsReport;
13 
36 class SalesRefundsReportEntityTest extends Injectable
37 {
38  /* tags */
39  const MVP = 'no';
40  /* end tags */
41 
47  protected $refundsReport;
48 
54  private $fixtureFactory;
55 
63  public function __inject(FixtureFactory $fixtureFactory, RefundsReport $refundsReport)
64  {
65  $this->refundsReport = $refundsReport;
66  $this->fixtureFactory = $fixtureFactory;
67  }
68 
76  public function test(OrderInjectable $order, array $refundsReport)
77  {
78  // Preconditions
79  $this->refundsReport->open();
80  $this->refundsReport->getMessagesBlock()->clickLinkInMessage('notice', 'here');
81  $this->refundsReport->getFilterBlock()->viewsReport($refundsReport);
82  $this->refundsReport->getActionBlock()->showReport();
83  $initialRefundsResult = $this->refundsReport->getGridBlock()->getLastResult();
84 
85  $order->persist();
86  $products = $order->getEntityId()['products'];
87  $cart['data']['items'] = ['products' => $products];
88  $cart = $this->fixtureFactory->createByCode('cart', $cart);
89  $invoice = $this->objectManager->create(
90  \Magento\Sales\Test\TestStep\CreateInvoiceStep::class,
91  ['order' => $order, 'cart' => $cart]
92  );
93  $invoice->run();
94  $creditMemo = $this->objectManager->create(
95  \Magento\Sales\Test\TestStep\CreateCreditMemoStep::class,
96  ['order' => $order, 'cart' => $cart]
97  );
98  $creditMemo->run();
99 
100  return ['initialRefundsResult' => $initialRefundsResult];
101  }
102 }
__inject(FixtureFactory $fixtureFactory, RefundsReport $refundsReport)
$order
Definition: order.php:55
$invoice