public function LanguageIntegrationTest::testSpecialCharacters in Facets 8
Tests that special characters work such as äüö work.
See also
https://www.drupal.org/node/2838247
https://www.drupal.org/node/2838697
File
- tests/
src/ Functional/ LanguageIntegrationTest.php, line 98
Class
- LanguageIntegrationTest
- Tests the integration with the language module.
Namespace
Drupal\Tests\facets\FunctionalCode
public function testSpecialCharacters() {
$id = 'water_bear';
$name = 'Water bear';
$this
->createFacet($name, $id, 'keywords');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetBlocksAppear();
$this
->assertFacetLabel('orange');
$entity_test_storage = \Drupal::entityTypeManager()
->getStorage('entity_test_mulrev_changed');
$entity_test_storage
->create([
'name' => 'special-chars 1',
'body' => 'test test test',
'type' => 'article',
'keywords' => [
'ƒäüö',
'test_key-word',
'special^%s',
'Key Word',
],
'category' => 'article_category',
])
->save();
$entity_test_storage
->create([
'name' => 'special-chars 2',
'body' => 'test test test',
'type' => 'article',
'keywords' => [
'ƒäüö',
'special^%s',
'aáå',
],
'category' => 'article_category',
])
->save();
$this
->assertEquals(2, $this
->indexItems($this->indexId), '2 items were indexed.');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetBlocksAppear();
$this
->assertFacetLabel('orange');
$this
->assertFacetLabel('ƒäüö');
$this
->assertFacetLabel('aáå');
$this
->assertFacetLabel('special^%s');
$this
->assertFacetLabel('test_key-word');
$this
->assertFacetLabel('Key Word');
}