You are here

protected function CommerceReportsSalesOverviewTestCase::_test in Commerce Reporting 7.3

4 calls to CommerceReportsSalesOverviewTestCase::_test()
CommerceReportsSalesOverviewTestCase::testMonthlyOverview in tests/commerce_reports.test
CommerceReportsSalesOverviewTestCase::testOutsideOverviewScope in tests/commerce_reports.test
CommerceReportsSalesOverviewTestCase::testTodayOverview in tests/commerce_reports.test
CommerceReportsSalesOverviewTestCase::testYesterdayOverview in tests/commerce_reports.test

File

tests/commerce_reports.test, line 195
Unit tests for the commerce reports module.

Class

CommerceReportsSalesOverviewTestCase

Code

protected function _test($data = array()) {
  foreach ($data as $display => $information) {
    $report = views_get_view_result('commerce_reports_sales_overview', $display);
    $line = reset($report);
    foreach ($information as &$metric) {
      if (empty($metric)) {
        $metric = NULL;
      }
    }
    if (empty($line->field_data_commerce_order_total_commerce_order_total_amount)) {
      $amount = 0;
    }
    else {
      $amount = $line->field_data_commerce_order_total_commerce_order_total_amount;
    }
    if (empty($line->order_id)) {
      $sales = NULL;
    }
    else {
      $sales = $line->order_id;
    }
    $this
      ->assertEqual($information['count'], $sales, t('The expected amount of orders is equal to the derived amount of orders.'));
    $this
      ->assertEqual($information['amount'], $amount, t('The expected total amount is equal to the derived total amount.'));
  }
}