summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/language/tests/src/Functional/LanguageBlockSettingsVisibilityTest.php
blob: 12697f62b966a4ef92f1953d053372728dc61a28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

declare(strict_types=1);

namespace Drupal\Tests\language\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests that the language settings on block config appears correctly.
 *
 * @group language
 */
class LanguageBlockSettingsVisibilityTest extends BrowserTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['block', 'language'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Tests languages displayed in the language switcher.
   */
  public function testUnnecessaryLanguageSettingsVisibility(): void {
    $admin_user = $this->drupalCreateUser([
      'administer languages',
      'access administration pages',
      'administer blocks',
    ]);
    $this->drupalLogin($admin_user);
    $this->drupalGet('admin/config/regional/language/add');
    $this->submitForm(['predefined_langcode' => 'hu'], 'Add language');
    $this->drupalGet('admin/structure/block/add/system_menu_block:admin/stark');
    $this->assertSession()->fieldNotExists("edit-visibility-language-langcodes-und");
    $this->assertSession()->fieldNotExists("edit-visibility-language-langcodes-zxx");
    $this->assertSession()->fieldExists("edit-visibility-language-langcodes-en");
    $this->assertSession()->fieldExists("edit-visibility-language-langcodes-hu");
  }

}