protected function HierarchicalFacetIntegrationTest::insertExampleContent in Facets 8
Same name in this branch
- 8 tests/src/Functional/HierarchicalFacetIntegrationTest.php \Drupal\Tests\facets\Functional\HierarchicalFacetIntegrationTest::insertExampleContent()
- 8 modules/facets_summary/tests/src/Functional/HierarchicalFacetIntegrationTest.php \Drupal\Tests\facets_summary\Functional\HierarchicalFacetIntegrationTest::insertExampleContent()
Creates several test entities with the term-reference field.
Overrides ExampleContentTrait::insertExampleContent
1 call to HierarchicalFacetIntegrationTest::insertExampleContent()
- HierarchicalFacetIntegrationTest::setUp in modules/
facets_summary/ tests/ src/ Functional/ HierarchicalFacetIntegrationTest.php
File
- modules/
facets_summary/ tests/ src/ Functional/ HierarchicalFacetIntegrationTest.php, line 213
Class
- HierarchicalFacetIntegrationTest
- Tests the hierarchical facets implementation.
Namespace
Drupal\Tests\facets_summary\FunctionalCode
protected function insertExampleContent() {
$entity_test_storage = \Drupal::entityTypeManager()
->getStorage('entity_test_mulrev_changed');
$this->entities[1] = $entity_test_storage
->create([
'name' => 'foo bar baz',
'body' => 'test test',
'type' => 'item',
'keywords' => [
'orange',
],
'category' => 'item_category',
$this->fieldName => [
$this->parents['Parent 1']
->id(),
],
]);
$this->entities[1]
->save();
$this->entities[2] = $entity_test_storage
->create([
'name' => 'foo test',
'body' => 'bar test',
'type' => 'item',
'keywords' => [
'orange',
'apple',
'grape',
],
'category' => 'item_category',
$this->fieldName => [
$this->parents['Parent 2']
->id(),
],
]);
$this->entities[2]
->save();
$this->entities[3] = $entity_test_storage
->create([
'name' => 'bar',
'body' => 'test foobar',
'type' => 'item',
$this->fieldName => [
$this->terms[1]
->id(),
],
]);
$this->entities[3]
->save();
$this->entities[4] = $entity_test_storage
->create([
'name' => 'foo baz',
'body' => 'test test test',
'type' => 'article',
'keywords' => [
'apple',
'strawberry',
'grape',
],
'category' => 'article_category',
$this->fieldName => [
$this->terms[2]
->id(),
],
]);
$this->entities[4]
->save();
$this->entities[5] = $entity_test_storage
->create([
'name' => 'bar baz',
'body' => 'foo',
'type' => 'article',
'keywords' => [
'orange',
'strawberry',
'grape',
'banana',
],
'category' => 'article_category',
$this->fieldName => [
$this->terms[3]
->id(),
],
]);
$this->entities[5]
->save();
$this->entities[6] = $entity_test_storage
->create([
'name' => 'bar baz',
'body' => 'foo',
'type' => 'article',
'keywords' => [
'orange',
'strawberry',
'grape',
'banana',
],
'category' => 'article_category',
$this->fieldName => [
$this->terms[4]
->id(),
],
]);
$this->entities[6]
->save();
}