protected function QueryGroupByTest::setupTestEntities in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/QueryGroupByTest.php \Drupal\Tests\views\Kernel\QueryGroupByTest::setupTestEntities()
Helper method that creates some test entities.
3 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::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 121
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();
}