You are here

public function ReportQueryBuilderTest::testGetQuery in Commerce Reporting 8

Tests ::getQuery.

File

tests/src/Kernel/ReportQueryBuilderTest.php, line 51

Class

ReportQueryBuilderTest
Tests ReportQueryBuilder.

Namespace

Drupal\Tests\commerce_reports\Kernel

Code

public function testGetQuery() {

  /** @var \Drupal\commerce_reports\Plugin\Commerce\ReportType\ReportTypeInterface $report_type_plugin */
  $report_type_plugin = $this->reportTypeManager
    ->createInstance('order_report');
  $query = $this->reportQueryBuilder
    ->getQuery($report_type_plugin);
  $this
    ->assertInstanceOf(QueryAggregateInterface::class, $query);
  $this
    ->assertTrue($query
    ->hasTag('commerce_reports'));
  $this
    ->assertEquals('F Y', $query
    ->getMetaData('report_date_format'));
  $query = $this->reportQueryBuilder
    ->getQuery($report_type_plugin, 'j F Y');
  $this
    ->assertEquals('j F Y', $query
    ->getMetaData('report_date_format'));
}