/**
  * Assert coupon info in report: code, rule name, subtotal, discount on coupons report page
  *
  * @param SalesCouponReportView $salesCouponReportView
  * @param OrderInjectable $order
  * @param string $currency
  * @return void
  */
 public function processAssert(SalesCouponReportView $salesCouponReportView, OrderInjectable $order, $currency = '$')
 {
     $data = $order->getData();
     $discount = $data['price']['discount'] != 0 ? '-' . $currency . number_format($data['price']['discount'], 2) : $currency . '0.00';
     $couponCode = $data['coupon_code']->getCouponCode();
     $filter = ['coupon_code' => $couponCode, 'rule_name' => $data['coupon_code']->getName(), 'subtotal' => $currency . number_format($data['price']['subtotal'], 2), 'discount' => $discount];
     \PHPUnit_Framework_Assert::assertTrue($salesCouponReportView->getGridBlock()->isRowVisible($filter, false), "Coupon with code - '{$couponCode}' is not visible.");
 }
 /**
  * Sales coupon report
  *
  * @param OrderInjectable $order
  * @param array $viewsReport
  * @return void
  */
 public function test(OrderInjectable $order, array $viewsReport)
 {
     // Precondition
     $order->persist();
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->orderView->getPageActions()->invoice();
     $this->orderInvoiceNew->getTotalsBlock()->submit();
     $this->reportStatistic->open();
     $this->reportStatistic->getGridBlock()->massaction([['report' => 'Coupons']], 'Refresh Statistics for the Last Day', true);
     // Steps
     $this->salesCouponReportView->open();
     $ruleName = $order->getCouponCode()->getName();
     $viewsReport['rules_list'] = str_replace('%rule_name%', $ruleName, $viewsReport['rules_list']);
     $this->salesCouponReportView->getFilterBlock()->viewsReport($viewsReport);
     $this->salesCouponReportView->getActionBlock()->showReport();
 }