You are here

protected function BlockLanguageTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 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() : void {
  parent::setUp();
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer blocks',
    'administer languages',
  ]);
  $this
    ->drupalLogin($this->adminUser);

  // Add predefined language.
  $edit = [
    'predefined_langcode' => 'fr',
  ];
  $this
    ->drupalGet('admin/config/regional/language/add');
  $this
    ->submitForm($edit, 'Add language');

  // Verify that language was added successfully.
  $this
    ->assertSession()
    ->pageTextContains('French');
}