public function SearchApiSortsUpdate8103Test::setUp in Search API sorts 8
Overrides WebTestBase::setUp() for update testing.
The main difference in this method is that rather than performing the installation via the installer, a database is loaded. Additional work is then needed to set various things such as the config directories and the container that would normally be done via the installer.
Overrides SearchApiSortsUpdateBase::setUp
File
- tests/
src/ Functional/ Update/ SearchApiSortsUpdate8103Test.php, line 41
Class
- SearchApiSortsUpdate8103Test
- Tests the Search api sorts upgrade path for update 8103.
Namespace
Drupal\Tests\search_api_sorts\Functional\UpdateCode
public function setUp() : void {
parent::setUp();
$this->languageManager = $this->container
->get('language_manager');
ConfigurableLanguage::createFromLangcode('fr')
->save();
// Create a search_api_sorts_field in the default language without
// translations.
$this
->createSearchApiSortsField('type');
// Create a search_api_sorts_field in a different language than the
// default one.
$this
->createSearchApiSortsField('id', [
'label' => 'Identifiant',
'langcode' => 'fr',
]);
// Create a search_api_sorts_field in the default language with a
// translation.
$this
->createSearchApiSortsField('created');
$field_config = $this->languageManager
->getLanguageConfigOverride('fr', 'search_api_sorts.search_api_sorts_field.views_page---search_api_sorts_test_view__page_1_created');
$field_config
->set('label', 'Créé sur')
->save();
// Create a search_api_sorts_field in a different language with a
// translation in the default language.
$this
->createSearchApiSortsField('title', [
'label' => 'Titre',
'langcode' => 'fr',
]);
$field_config = $this->languageManager
->getLanguageConfigOverride('en', 'search_api_sorts.search_api_sorts_field.views_page---search_api_sorts_test_view__page_1_title');
$field_config
->set('label', 'Title')
->save();
}