You are here

public function LanguageUILanguageNegotiationTest::testDisableLanguageSwitcher in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php \Drupal\language\Tests\LanguageUILanguageNegotiationTest::testDisableLanguageSwitcher()

Tests if the language switcher block gets deleted when a language type has been made not configurable.

File

core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php, line 519
Contains \Drupal\language\Tests\LanguageUILanguageNegotiationTest.

Class

LanguageUILanguageNegotiationTest
Tests the language UI for language switching.

Namespace

Drupal\language\Tests

Code

public function testDisableLanguageSwitcher() {
  $block_id = 'test_language_block';

  // Enable the language switcher block.
  $this
    ->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_CONTENT, array(
    'id' => $block_id,
  ));

  // Check if the language switcher block has been created.
  $block = Block::load($block_id);
  $this
    ->assertTrue($block, 'Language switcher block was created.');

  // Make sure language_content is not configurable.
  $edit = array(
    'language_content[configurable]' => FALSE,
  );
  $this
    ->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
  $this
    ->assertResponse(200);

  // Check if the language switcher block has been removed.
  $block = Block::load($block_id);
  $this
    ->assertFalse($block, 'Language switcher block was removed.');
}