Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertRefundNotInRefundsGrid.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Sales\Test\Page\Adminhtml\CreditMemoIndex;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
16 class AssertRefundNotInRefundsGrid extends AbstractConstraint
17 {
26  public function processAssert(CreditMemoIndex $creditMemoIndex, OrderInjectable $order, array $ids)
27  {
28  $creditMemoIndex->open();
29  $amount = $order->getPrice()['refund'];
30  $orderId = $order->getId();
31  foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
32  $filter = [
33  'id' => $creditMemoId,
34  'order_id' => $orderId,
35  'grand_total_from' => $amount[$key]['grand_creditmemo_total'],
36  'grand_total_to' => $amount[$key]['grand_creditmemo_total'],
37  ];
38  $creditMemoIndex->getCreditMemoGrid()->search($filter);
39  $filter['grand_total_from'] = number_format($amount[$key]['grand_creditmemo_total'], 2);
40  $filter['grand_total_to'] = number_format($amount[$key]['grand_creditmemo_total'], 2);
41  \PHPUnit\Framework\Assert::assertFalse(
42  $creditMemoIndex->getCreditMemoGrid()->isRowVisible($filter, false, false),
43  "Credit memo '#$creditMemoId' is present in credit memos grid on credit memo index page."
44  );
45  }
46  }
47 
53  public function toString()
54  {
55  return 'Credit memo is absent in credit memos grid on credit memo index page.';
56  }
57 }
$order
Definition: order.php:55
$amount
Definition: order.php:14
processAssert(CreditMemoIndex $creditMemoIndex, OrderInjectable $order, array $ids)