function QueryGroupByTest::setupTestEntities
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::setupTestEntities()
- 8.9.x core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::setupTestEntities()
- 11.x core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::setupTestEntities()
Helper method that creates some test entities.
4 calls to QueryGroupByTest::setupTestEntities()
- QueryGroupByTest::groupByTestHelper in core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php - Provides a test helper which runs a view with some aggregation function.
- QueryGroupByTest::testAggregateCount in core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php - Tests aggregate count feature.
- QueryGroupByTest::testAggregateCountFunction in core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php - Tests aggregate count feature with no group by.
- QueryGroupByTest::testGroupByBaseField in core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php - Tests grouping on base field.
File
-
core/
modules/ views/ tests/ src/ Kernel/ QueryGroupByTest.php, line 142
Class
- QueryGroupByTest
- Tests aggregate functionality of views, for example count.
Namespace
Drupal\Tests\views\KernelCode
protected function setupTestEntities() {
// Create 4 entities with name1 and 3 entities with name2.
$entity_1 = [
'name' => 'name1',
];
$this->storage
->create($entity_1)
->save();
$this->storage
->create($entity_1)
->save();
$this->storage
->create($entity_1)
->save();
$this->storage
->create($entity_1)
->save();
$entity_2 = [
'name' => 'name2',
];
$this->storage
->create($entity_2)
->save();
$this->storage
->create($entity_2)
->save();
$this->storage
->create($entity_2)
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.