function ConfigTranslationCacheTest::setUp

Same name in other branches
  1. 9 core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationCacheTest::setUp()
  2. 8.9.x core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationCacheTest::setUp()
  3. 10 core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php \Drupal\Tests\config_translation\Functional\ConfigTranslationCacheTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/config_translation/tests/src/Functional/ConfigTranslationCacheTest.php, line 76

Class

ConfigTranslationCacheTest
Translate settings and entities to various languages.

Namespace

Drupal\Tests\config_translation\Functional

Code

protected function setUp() : void {
    parent::setUp();
    $translator_permissions = [
        'translate configuration',
    ];
    
    /** @var \Drupal\filter\FilterFormatInterface $filter_test_format */
    $filter_test_format = FilterFormat::load('filter_test');
    
    /** @var \Drupal\filter\FilterFormatInterface $filtered_html_format */
    $filtered_html_format = FilterFormat::load('filtered_html');
    
    /** @var \Drupal\filter\FilterFormatInterface $full_html_format */
    $full_html_format = FilterFormat::load('full_html');
    $admin_permissions = array_merge($translator_permissions, [
        'administer languages',
        'administer site configuration',
        'link to any page',
        'administer contact forms',
        'administer filters',
        $filtered_html_format->getPermissionName(),
        $full_html_format->getPermissionName(),
        $filter_test_format->getPermissionName(),
        'access site-wide contact form',
        'access contextual links',
        'administer account settings',
        'administer themes',
        'bypass node access',
        'administer content types',
        'translate interface',
        'administer entity_test fields',
    ]);
    // Create and login user.
    $this->translatorUser = $this->drupalCreateUser($translator_permissions);
    $this->adminUser = $this->drupalCreateUser($admin_permissions);
    // Add languages.
    foreach ($this->langcodes as $langcode) {
        ConfigurableLanguage::createFromLangcode($langcode)->save();
    }
    $this->drupalPlaceBlock('local_tasks_block');
    $this->drupalPlaceBlock('page_title_block');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.