You are here

protected function SearchApiSolrMultilingualTest::insertMultilingualExampleContent in Search API Solr 8.2

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 216

Class

SearchApiSolrMultilingualTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function insertMultilingualExampleContent() {
  $this
    ->addTestEntity(1, [
    'name' => 'en 1',
    'body' => 'gene',
    'type' => 'item',
    'langcode' => 'en',
  ]);
  $this
    ->addTestEntity(2, [
    'name' => 'en 2',
    'body' => 'genes',
    'type' => 'item',
    'langcode' => 'en',
  ]);
  $this
    ->addTestEntity(3, [
    'name' => 'de 3',
    'body' => 'Gen',
    'type' => 'item',
    'langcode' => 'de',
  ]);
  $this
    ->addTestEntity(4, [
    'name' => 'de 4',
    'body' => 'Gen',
    'type' => 'item',
    'langcode' => 'de',
  ]);
  $this
    ->addTestEntity(5, [
    'name' => 'de-at 5',
    'body' => 'Gen',
    'type' => 'item',
    'langcode' => 'de-at',
  ]);
  $this
    ->addTestEntity(6, [
    'name' => 'de-at 6',
    'body' => 'Gen',
    'type' => 'item',
    'langcode' => 'de-at',
  ]);
  $this
    ->addTestEntity(7, [
    'name' => 'und 7',
    'body' => 'gene',
    'type' => 'item',
    'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
  ]);
  $this
    ->addTestEntity(8, [
    '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.");
}