You are here

protected function QueryGroupByTest::setupTestEntities in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/QueryGroupByTest.php \Drupal\views\Tests\QueryGroupByTest::setupTestEntities()

Helper method that creates some test entities.

3 calls to QueryGroupByTest::setupTestEntities()
QueryGroupByTest::groupByTestHelper in core/modules/views/src/Tests/QueryGroupByTest.php
Provides a test helper which runs a view with some aggregation function.
QueryGroupByTest::testAggregateCount in core/modules/views/src/Tests/QueryGroupByTest.php
Tests aggregate count feature.
QueryGroupByTest::testGroupByBaseField in core/modules/views/src/Tests/QueryGroupByTest.php
Tests grouping on base field.

File

core/modules/views/src/Tests/QueryGroupByTest.php, line 120
Contains \Drupal\views\Tests\QueryGroupByTest.

Class

QueryGroupByTest
Tests aggregate functionality of views, for example count.

Namespace

Drupal\views\Tests

Code

protected function setupTestEntities() {

  // Create 4 entities with name1 and 3 entities with name2.
  $entity_1 = array(
    '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 = array(
    'name' => 'name2',
  );
  $this->storage
    ->create($entity_2)
    ->save();
  $this->storage
    ->create($entity_2)
    ->save();
  $this->storage
    ->create($entity_2)
    ->save();
}