protected function ReportQueryBuilderTest::getSqlQueryFromAggregateQuery in Commerce Reporting 8
Gets an sql query from an aggreggate query.
Parameters
\Drupal\Core\Entity\Query\Sql\QueryAggregate $query: The aggregate query.
Return value
\Drupal\Core\Database\Query\SelectInterface The sql query.
1 call to ReportQueryBuilderTest::getSqlQueryFromAggregateQuery()
- ReportQueryBuilderTest::testAlterQuery in tests/
src/ Kernel/ ReportQueryBuilderTest.php - Tests ::alterQuery.
File
- tests/
src/ Kernel/ ReportQueryBuilderTest.php, line 129
Class
- ReportQueryBuilderTest
- Tests ReportQueryBuilder.
Namespace
Drupal\Tests\commerce_reports\KernelCode
protected function getSqlQueryFromAggregateQuery(QueryAggregate $query) {
$query
->prepare();
$reflection = new \ReflectionObject($query);
$property = $reflection
->getProperty('sqlQuery');
$property
->setAccessible(TRUE);
/** @var \Drupal\Core\Database\Query\SelectInterface $sqlQuery */
$sqlQuery = $property
->getValue($query);
$this
->assertInstanceOf(SelectInterface::class, $sqlQuery);
return $sqlQuery;
}