1 views_groupby.test public ViewsQueryGroupByTest::testGroupByCountOnlyFilters()

File

core/modules/views/tests/views_groupby.test, line 237
Tests aggregate functionality of Views.

Class

ViewsQueryGroupByTest
Tests aggregate functionality of views, for example count.

Code

public function testGroupByCountOnlyFilters() {
  // Check if GROUP BY and HAVING are included when a view
  // Doesn't display SUM, COUNT, MAX... functions in SELECT statment

  $type1 = $this->backdropCreateContentType();

  $node_1 = array(
    'type' => $type1->type,
  );
  for ($x = 0; $x < 10; $x++) {
    $this->backdropCreateNode($node_1);
  }

  $view = $this->viewsGroupByCountViewOnlyFilters();
  $output = $view->execute_display();

  $this->assertTrue(strpos($view->build_info['query'], 'GROUP BY'), t('Make sure that GROUP BY is in the query'));
  $this->assertTrue(strpos($view->build_info['query'], 'HAVING'), t('Make sure that HAVING is in the query'));
}