You are here

protected function SearchApiSolrTest::checkSchemaLanguages in Search API Solr 4.x

Tests if all supported languages are deployed correctly.

1 call to SearchApiSolrTest::checkSchemaLanguages()
SearchApiSolrTest::checkBackendSpecificFeatures in tests/src/Kernel/SearchApiSolrTest.php
Checks backend specific features.
1 method overrides SearchApiSolrTest::checkSchemaLanguages()
SolrLegacyTest::checkSchemaLanguages in modules/search_api_solr_legacy/tests/src/Kernel/SolrLegacyTest.php
Tests the conversion of Search API queries into Solr queries.

File

tests/src/Kernel/SearchApiSolrTest.php, line 277

Class

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

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function checkSchemaLanguages() {

  /** @var \Drupal\search_api_solr\SolrBackendInterface $backend */
  $backend = Server::load($this->serverId)
    ->getBackend();
  $connector = $backend
    ->getSolrConnector();
  $targeted_solr_major_version = (int) $connector
    ->getSchemaTargetedSolrBranch();
  $language_ids = $this->languageIds;
  if (version_compare($targeted_solr_major_version, '9', '<')) {

    // 'et' requires Solr 8.2, the jump-start-config targets 8.0.
    $language_ids['et'] = FALSE;
    if (version_compare($targeted_solr_major_version, '8', '<')) {

      // 'ga' requires Solr 7.7, the jump-start-config targets 7.0.
      $language_ids['ga'] = FALSE;
      if (version_compare($targeted_solr_major_version, '7', '<')) {
        $language_ids['bg'] = FALSE;
        $language_ids['ca'] = FALSE;
        $language_ids['da'] = FALSE;
        $language_ids['fa'] = FALSE;
        $language_ids['hi'] = FALSE;
        $language_ids['hr'] = FALSE;
        $language_ids['id'] = FALSE;
        $language_ids['lv'] = FALSE;
        $language_ids['nb'] = FALSE;
        $language_ids['nn'] = FALSE;
        $language_ids['pl'] = FALSE;
        $language_ids['pt-br'] = FALSE;
        $language_ids['pt-pt'] = FALSE;
        $language_ids['ro'] = FALSE;
        $language_ids['sr'] = FALSE;
        $language_ids['sv'] = FALSE;
        $language_ids['th'] = FALSE;
        $language_ids['tr'] = FALSE;
        $language_ids['zh-hans'] = FALSE;
        $language_ids['zh-hant'] = FALSE;
        if (version_compare($targeted_solr_major_version, '6', '<')) {
          $language_ids['ar'] = FALSE;
          $language_ids['ja'] = FALSE;
          $language_ids['hu'] = FALSE;
          $language_ids['sk'] = FALSE;
          if (version_compare($targeted_solr_major_version, '5', '<')) {
            $language_ids['cs'] = FALSE;
          }
        }
      }
    }
  }
  $this
    ->assertEquals($language_ids, $backend
    ->getSchemaLanguageStatistics());
}