function ViewsQueryGroupByTest::testGroupByCountOnlyFilters

File

tests/views_groupby.test, line 364

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->drupalCreateContentType();
    $node_1 = array(
        'type' => $type1->type,
    );
    for ($x = 0; $x < 10; $x++) {
        $this->drupalCreateNode($node_1);
    }
    $view = $this->viewsGroupByCountViewOnlyFilters();
    $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'));
}