protected function ExampleContentTrait::insertExampleContent in Search API 8
Creates several test entities.
7 calls to ExampleContentTrait::insertExampleContent()
- AutocompleteTest::setUp in modules/
search_api_db/ tests/ src/ Kernel/ AutocompleteTest.php - BackendTest::testRegression2949962 in modules/
search_api_db/ tests/ src/ Kernel/ BackendTest.php - Tests negated fulltext searches with substring matching.
- BackendTestBase::testBackend in tests/
src/ Kernel/ BackendTestBase.php - Tests various indexing scenarios for the search backend.
- CacheabilityTest::setUp in tests/
src/ Functional/ CacheabilityTest.php - CommandHelperTest::setUp in tests/
src/ Kernel/ System/ CommandHelperTest.php
File
- tests/
src/ Functional/ ExampleContentTrait.php, line 38
Class
- ExampleContentTrait
- Contains helpers to create data that can be used by tests.
Namespace
Drupal\Tests\search_api\FunctionalCode
protected function insertExampleContent() {
// To test Unicode compliance, include all kind of strange characters here.
$smiley = json_decode('"\\u1F601"');
$this
->addTestEntity(1, [
'name' => 'foo bar baz foobaz föö smile' . $smiley,
'body' => 'test test case Case casE',
'type' => 'item',
'keywords' => [
'Orange',
'orange',
'örange',
'Orange',
$smiley,
],
'category' => 'item_category',
]);
$this
->addTestEntity(2, [
'name' => 'foo test foobuz',
'body' => 'bar test casE',
'type' => 'item',
'keywords' => [
'orange',
'apple',
'grape',
],
'category' => 'item_category',
]);
$this
->addTestEntity(3, [
'name' => 'bar',
'body' => 'test foobar Case',
'type' => 'item',
]);
$this
->addTestEntity(4, [
'name' => 'foo baz',
'body' => 'test test test',
'type' => 'article',
'keywords' => [
'apple',
'strawberry',
'grape',
],
'category' => 'article_category',
'width' => '1.0',
]);
$this
->addTestEntity(5, [
'name' => 'bar baz',
'body' => 'foo',
'type' => 'article',
'keywords' => [
'orange',
'strawberry',
'grape',
'banana',
],
'category' => 'article_category',
'width' => '2.0',
]);
$count = \Drupal::entityQuery('entity_test_mulrev_changed')
->accessCheck(FALSE)
->count()
->execute();
$this
->assertEquals(5, $count, "{$count} items inserted.");
}