protected function SearchApiSolrMultilingualTest::insertMultilingualExampleContent in Search API Multilingual Solr Search 8
Creates several test entities.
2 calls to SearchApiSolrMultilingualTest::insertMultilingualExampleContent()
- SearchApiSolrMultilingualTest::testLanguageFallback in tests/
src/ Kernel/ SearchApiSolrMultilingualTest.php - Tests language fallback.
- SearchApiSolrMultilingualTest::testLanguageLimitedByOptions in tests/
src/ Kernel/ SearchApiSolrMultilingualTest.php - Tests language limiting via options.
File
- tests/
src/ Kernel/ SearchApiSolrMultilingualTest.php, line 248
Class
- SearchApiSolrMultilingualTest
- Tests index and search capabilities using the Solr search backend.
Namespace
Drupal\Tests\search_api_solr_multilingual\KernelCode
protected function insertMultilingualExampleContent() {
$this
->addTestEntity(1, array(
'name' => 'en 1',
'body' => 'gene',
'type' => 'item',
'langcode' => 'en',
));
$this
->addTestEntity(2, array(
'name' => 'en 2',
'body' => 'genes',
'type' => 'item',
'langcode' => 'en',
));
$this
->addTestEntity(3, array(
'name' => 'de 3',
'body' => 'Gen',
'type' => 'item',
'langcode' => 'de',
));
$this
->addTestEntity(4, array(
'name' => 'de 4',
'body' => 'Gen',
'type' => 'item',
'langcode' => 'de',
));
$this
->addTestEntity(5, array(
'name' => 'de-at 5',
'body' => 'Gen',
'type' => 'item',
'langcode' => 'de-at',
));
$this
->addTestEntity(6, array(
'name' => 'de-at 6',
'body' => 'Gen',
'type' => 'item',
'langcode' => 'de-at',
));
$this
->addTestEntity(7, array(
'name' => 'und 7',
'body' => 'gene',
'type' => 'item',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
));
$this
->addTestEntity(8, array(
'name' => 'zxx 8',
'body' => 'gene',
'type' => 'item',
'langcode' => LanguageInterface::LANGCODE_NOT_APPLICABLE,
));
$count = \Drupal::entityQuery('entity_test_mulrev_changed')
->count()
->execute();
$this
->assertEquals(8, $count, "{$count} items inserted.");
}