Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertInvoiceInInvoicesTab.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
12 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
13 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
14 
18 class AssertInvoiceInInvoicesTab extends AbstractConstraint
19 {
29  public function processAssert(
30  SalesOrderView $salesOrderView,
31  OrderIndex $orderIndex,
32  OrderInjectable $order,
33  array $ids
34  ) {
35  $orderIndex->open();
36  $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
37  $salesOrderView->getOrderForm()->openTab('invoices');
39  $grid = $salesOrderView->getOrderInvoiceGrid();
40  $amount = $order->getPrice()['invoice'];
41  foreach ($ids['invoiceIds'] as $key => $invoiceId) {
42  $filter = [
43  'id' => $invoiceId,
44  'grand_total_from' => $amount[$key]['grand_invoice_total'],
45  'grand_total_to' => $amount[$key]['grand_invoice_total'],
46  ];
47  $grid->search($filter);
48  $filter['amount_from'] = number_format($amount[$key]['grand_invoice_total'], 2);
49  unset($filter['amount_to']);
50  \PHPUnit\Framework\Assert::assertTrue(
51  $grid->isRowVisible($filter, false, false),
52  'Invoice is absent on invoices tab.'
53  );
54  }
55  }
56 
62  public function toString()
63  {
64  return 'Invoice is present on invoices tab.';
65  }
66 }
$order
Definition: order.php:55
$amount
Definition: order.php:14