function BlockLanguageTest::setUp

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

Overrides BrowserTestBase::setUp

File

core/modules/block/tests/src/Functional/BlockLanguageTest.php, line 33

Class

BlockLanguageTest
Tests if a block can be configured to be only visible on a particular language.

Namespace

Drupal\Tests\block\Functional

Code

protected function setUp() {
    parent::setUp();
    $this->adminUser = $this->drupalCreateUser([
        'administer blocks',
        'administer languages',
    ]);
    $this->drupalLogin($this->adminUser);
    // Add predefined language.
    $edit = [
        'predefined_langcode' => 'fr',
    ];
    $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
    $this->assertText('French', 'Language added successfully.');
}

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