public function TranslationTest::setUp in Search API sorts 8
Overrides SortsFunctionalBase::setUp
File
- tests/
src/ Functional/ TranslationTest.php, line 38
Class
- TranslationTest
- Tests Search API sorts translation.
Namespace
Drupal\Tests\search_api_sorts\FunctionalCode
public function setUp() : void {
parent::setUp();
// Create FR language.
$entity_type = $this->container
->get('entity_type.manager')
->getDefinition('configurable_language');
$this->container
->get('entity_type.listener')
->onEntityTypeCreate($entity_type);
ConfigurableLanguage::createFromLangcode('fr')
->save();
// Enable language negotiation using path prefixes.
$this
->config('language.negotiation')
->set('url.source', 'path_prefix')
->set('url.prefixes', [
'en' => 'en',
'fr' => 'fr',
])
->save();
$block_settings = [
'region' => 'footer',
'id' => 'sorts_id',
];
$this
->drupalPlaceBlock('search_api_sorts_block:' . $this->displayId, $block_settings);
$this->searchApiSortsFieldStorage = $this->container
->get('entity_type.manager')
->getStorage('search_api_sorts_field');
}