Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertInvoiceInInvoicesGrid.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Sales\Test\Page\Adminhtml\InvoiceIndex;
12 
17 class AssertInvoiceInInvoicesGrid extends AbstractConstraint
18 {
19  /* tags */
20  const SEVERITY = 'low';
21  /* end tags */
22 
31  public function processAssert(InvoiceIndex $invoiceIndex, OrderInjectable $order, array $ids)
32  {
33  $invoiceIndex->open();
34  $amount = $order->getPrice()['invoice'];
35  $orderId = $order->getId();
36  foreach ($ids['invoiceIds'] as $key => $invoiceId) {
37  $filter = [
38  'id' => $invoiceId,
39  'order_id' => $orderId,
40  'grand_total_from' => $amount[$key]['grand_invoice_total'],
41  'grand_total_to' => $amount[$key]['grand_invoice_total'],
42  ];
43  $invoiceIndex->getInvoicesGrid()->search($filter);
44  $filter['grand_total_from'] = number_format($amount[$key]['grand_invoice_total'], 2);
45  $filter['grand_total_to'] = number_format($amount[$key]['grand_invoice_total'], 2);
46  \PHPUnit\Framework\Assert::assertTrue(
47  $invoiceIndex->getInvoicesGrid()->isRowVisible($filter, false, false),
48  'Invoice is absent in invoices grid on invoice index page.'
49  );
50  }
51  }
52 
58  public function toString()
59  {
60  return 'Invoice is present in the invoices grid with corresponding amount on invoice index page.';
61  }
62 }
processAssert(InvoiceIndex $invoiceIndex, OrderInjectable $order, array $ids)
$order
Definition: order.php:55
$amount
Definition: order.php:14