You are here

public function LocalTranslatorTest::testSettings in Translation Management Tool 8

Test the settings of TMGMT local.

File

translators/tmgmt_local/tests/src/Functional/LocalTranslatorTest.php, line 993

Class

LocalTranslatorTest
Basic tests for the local translator.

Namespace

Drupal\Tests\tmgmt_local\Functional

Code

public function testSettings() {
  \Drupal::getContainer()
    ->get('theme_installer')
    ->install([
    'seven',
  ]);
  $this
    ->drupalPlaceBlock('system_menu_block:account');
  $this
    ->loginAsAdmin($this->localManagerPermissions);
  $edit = [
    'admin_theme' => 'seven',
    'use_admin_theme' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
  $settings = \Drupal::config('tmgmt_local.settings');
  $this
    ->assertTrue($settings
    ->get('use_admin_theme'));
  $this
    ->drupalGet('admin/tmgmt');
  $this
    ->assertText('Translate');
  $this
    ->drupalGet('<front>');
  $this
    ->assertNoText('Translate');
  $this
    ->drupalGet('admin/tmgmt/settings');
  $edit = [
    'use_admin_theme' => FALSE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save configuration'));
  $settings = \Drupal::config('tmgmt_local.settings');
  $this
    ->assertFalse($settings
    ->get('use_admin_theme'));
  $this
    ->drupalGet('admin/tmgmt');
  $this
    ->assertNoText('Translate');
  $this
    ->drupalGet('<front>');
  $this
    ->assertText('Translate');
}