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