You are here

public function NodeTranslationUITest::testTranslationLinkTheme in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/NodeTranslationUITest.php \Drupal\node\Tests\NodeTranslationUITest::testTranslationLinkTheme()

Tests that translation page inherits admin status of edit page.

File

core/modules/node/src/Tests/NodeTranslationUITest.php, line 225
Contains \Drupal\node\Tests\NodeTranslationUITest.

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\node\Tests

Code

public function testTranslationLinkTheme() {
  $this
    ->drupalLogin($this->administrator);
  $article = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'langcode' => $this->langcodes[0],
  ));

  // Set up Seven as the admin theme and use it for node editing.
  $this->container
    ->get('theme_handler')
    ->install(array(
    'seven',
  ));
  $edit = array();
  $edit['admin_theme'] = 'seven';
  $edit['use_admin_theme'] = TRUE;
  $this
    ->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
  $this
    ->drupalGet('node/' . $article
    ->id() . '/translations');
  $this
    ->assertRaw('core/themes/seven/css/base/elements.css', 'Translation uses admin theme if edit is admin.');

  // Turn off admin theme for editing, assert inheritance to translations.
  $edit['use_admin_theme'] = FALSE;
  $this
    ->drupalPostForm('admin/appearance', $edit, t('Save configuration'));
  $this
    ->drupalGet('node/' . $article
    ->id() . '/translations');
  $this
    ->assertNoRaw('core/themes/seven/css/base/elements.css', 'Translation uses frontend theme if edit is frontend.');

  // Assert presence of translation page itself (vs. DisabledBundle below).
  $this
    ->assertResponse(200);
}