You are here

protected function ConfigWithTranslationTest::setUp in Config Ignore 8.3

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ConfigWithTranslationTest.php, line 39

Class

ConfigWithTranslationTest
Tests config_ignore with translated configurations.

Namespace

Drupal\Tests\config_ignore\Functional

Code

protected function setUp() {
  parent::setUp();
  ConfigurableLanguage::createFromLangcode('ro')
    ->save();

  // Add a translation to user.role.anonymous and user.role.authenticated.
  $this
    ->translateConfig('user.role.anonymous', 'label', 'Utilizator anonim', 'ro');
  $this
    ->translateConfig('user.role.authenticated', 'label', 'Utilizator autentificat', 'ro');

  // Export the default configuration.
  $this
    ->drush('config:export', [], [
    'yes' => NULL,
  ]);

  // Check that configs (and translations) were exported in the sync store.
  $this
    ->assertExportedValue('user.settings', 'anonymous', 'Anonymous');
  $this
    ->assertExportedValue('user.role.anonymous', 'label', 'Anonymous user');
  $this
    ->assertExportedValue('user.role.anonymous', 'label', 'Utilizator anonim', 'ro');
  $this
    ->assertExportedValue('user.role.authenticated', 'label', 'Authenticated user');
  $this
    ->assertExportedValue('user.role.authenticated', 'weight', 1);
  $this
    ->assertExportedValue('user.role.authenticated', 'is_admin', FALSE);
  $this
    ->assertExportedValue('user.role.authenticated', 'label', 'Utilizator autentificat', 'ro');

  // Ignore user.role.anonymous and two keys from user.role.authenticated.
  $this
    ->config('config_ignore.settings')
    ->set('ignored_config_entities', [
    'user.role.anonymous',
    'user.role.authenticated:weight',
    'user.role.authenticated:is_admin',
  ])
    ->save();
}