/**
  * Assert that refund is present in the 'Refunds' grid with correct ID, order ID, refunded amount
  *
  * @param CreditMemoIndex $creditMemoIndex
  * @param OrderInjectable $order
  * @param array $ids
  * @return void
  */
 public function processAssert(CreditMemoIndex $creditMemoIndex, OrderInjectable $order, array $ids)
 {
     $creditMemoIndex->open();
     $amount = $order->getPrice();
     $orderId = $order->getId();
     foreach ($ids['creditMemoIds'] as $key => $creditMemoId) {
         $filter = ['id' => $creditMemoId, 'order_id' => $orderId, 'grand_total_from' => $amount[$key]['grand_creditmemo_total'], 'grand_total_to' => $amount[$key]['grand_creditmemo_total']];
         $creditMemoIndex->getCreditMemoGrid()->search($filter);
         $filter['grand_total_from'] = number_format($amount[$key]['grand_creditmemo_total'], 2);
         $filter['grand_total_to'] = number_format($amount[$key]['grand_creditmemo_total'], 2);
         \PHPUnit_Framework_Assert::assertTrue($creditMemoIndex->getCreditMemoGrid()->isRowVisible($filter, false, false), "Credit memo '#{$creditMemoId}' is absent in credit memos grid on credit memo index page.");
     }
 }
 /**
  * Assert that creditmemo is present in the creditmemos grid
  *
  * @param CreditMemoIndex $creditmemoIndex
  * @param array           $ids
  *
  * @return void
  */
 public function processAssert(CreditMemoIndex $creditmemoIndex, array $ids)
 {
     foreach ($ids as $orderId => $creditmemoIds) {
         $creditmemoIndex->open();
         $grid = $creditmemoIndex->getCreditMemoGrid();
         foreach ($creditmemoIds as $creditmemoId) {
             $filter = ['id' => $creditmemoId, 'order_id' => $orderId];
             $grid->search($filter);
             \PHPUnit_Framework_Assert::assertTrue($grid->isRowVisible($filter, false, true), 'Creditmemo is absent on creditmemos grid.');
         }
     }
 }
 /**
  * Assert credit memo items on credit memo view page
  *
  * @param CreditMemoIndex $creditMemoIndex
  * @param SalesCreditMemoView $salesCreditMemoView
  * @param OrderInjectable $order
  * @param array $ids
  * @param array|null $data [optional]
  * @return void
  */
 public function processAssert(CreditMemoIndex $creditMemoIndex, SalesCreditMemoView $salesCreditMemoView, OrderInjectable $order, array $ids, array $data = null)
 {
     $creditMemoIndex->open();
     $orderId = $order->getId();
     $productsData = $this->prepareOrderProducts($order, $data['items_data']);
     foreach ($ids['creditMemoIds'] as $creditMemoId) {
         $filter = ['order_id' => $orderId, 'id' => $creditMemoId];
         $creditMemoIndex->getCreditMemoGrid()->searchAndOpen($filter);
         $itemsData = $this->preparePageItems($salesCreditMemoView->getItemsBlock()->getData());
         $error = $this->verifyData($productsData, $itemsData);
         \PHPUnit_Framework_Assert::assertEmpty($error, $error);
     }
 }