public function UtilitiesTest::testLanguageSpecificFieldTypeNames in Search API Solr 8.3
Same name and namespace in other branches
- 8.2 tests/src/Kernel/UtilitiesTest.php \Drupal\Tests\search_api_solr\Kernel\UtilitiesTest::testLanguageSpecificFieldTypeNames()
- 4.x tests/src/Kernel/UtilitiesTest.php \Drupal\Tests\search_api_solr\Kernel\UtilitiesTest::testLanguageSpecificFieldTypeNames()
Tests language-specific Solr field names.
File
- tests/
src/ Kernel/ UtilitiesTest.php, line 48
Class
- UtilitiesTest
- Provides tests for various utility functions.
Namespace
Drupal\Tests\search_api_solr\KernelCode
public function testLanguageSpecificFieldTypeNames() {
$this
->assertEquals('text_de', Utility::encodeSolrName('text_de'));
// Drupal-like locale for Austria.
$encoded = Utility::encodeSolrName('text_de-at');
$this
->assertEquals('text_de_X2d_at', $encoded);
$this
->assertEquals('text_de-at', Utility::decodeSolrName($encoded));
// Traditional Chinese as used in Hong Kong.
$encoded = Utility::encodeSolrName('text_zh-Hant-HK');
$this
->assertEquals('text_zh_X2d_Hant_X2d_HK', $encoded);
$this
->assertEquals('text_zh-Hant-HK', Utility::decodeSolrName($encoded));
// The variant of German orthography dating from the 1901 reforms, as seen
// in Switzerland.
$encoded = Utility::encodeSolrName('text_de-CH-1901');
$this
->assertEquals('text_de_X2d_CH_X2d_1901', $encoded);
$this
->assertEquals('text_de-CH-1901', Utility::decodeSolrName($encoded));
}