function QueryGroupByTest::testAggregateCountFunction

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::testAggregateCountFunction()
  2. 11.x core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::testAggregateCountFunction()

Tests aggregate count feature with no group by.

File

core/modules/views/tests/src/Kernel/QueryGroupByTest.php, line 92

Class

QueryGroupByTest
Tests aggregate functionality of views, for example count.

Namespace

Drupal\Tests\views\Kernel

Code

public function testAggregateCountFunction() : void {
  $this->setupTestEntities();
  $view = Views::getView('test_aggregate_count_function');
  $this->executeView($view);
  $this->assertEquals(7, $view->result[0]->id);
  $this->assertCount(1, $view->result, 'Make sure the count of rows is one.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.