You are here

function CommerceReportsViewsExportTestCase::testProductViewsDataExport in Commerce Reporting 7.4

File

src/Tests/CommerceReportsViewsExportTestCase.php, line 46

Class

CommerceReportsViewsExportTestCase
Class CommerceReportsViewsExportTestCase

Namespace

Drupal\commerce_reports\Tests

Code

function testProductViewsDataExport() {
  $this
    ->createProducts(5);
  $this
    ->createOrders(5);
  $products = $this
    ->createdProductsData();
  $rendered = $this
    ->getRenderedExport('commerce_reports_products');
  $this
    ->assertCsvHeaders('"Type","Product","Title","Sold","Revenue"', $rendered[0]);
  array_shift($rendered);
  $this
    ->assertEqual(count($rendered), count($products), t('The amount of products (%reported) that is reported (%generated) upon is correct.', array(
    '%reported' => count($rendered),
    '%generated' => count($products),
  )));
}