public function NodeTranslationUITest::testTranslationLinkTheme in Drupal 10
Same name and namespace in other branches
- 8 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::testTranslationLinkTheme()
- 9 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::testTranslationLinkTheme()
Tests that translation page inherits admin status of edit page.
File
- core/
modules/ node/ tests/ src/ Functional/ NodeTranslationUITest.php, line 251
Class
- NodeTranslationUITest
- Tests the Node Translation UI.
Namespace
Drupal\Tests\node\FunctionalCode
public function testTranslationLinkTheme() {
$this
->drupalLogin($this->administrator);
$article = $this
->drupalCreateNode([
'type' => 'article',
'langcode' => $this->langcodes[0],
]);
// Set up the default admin theme and use it for node editing.
$this->container
->get('theme_installer')
->install([
'claro',
]);
$edit = [];
$edit['admin_theme'] = 'claro';
$edit['use_admin_theme'] = TRUE;
$this
->drupalGet('admin/appearance');
$this
->submitForm($edit, 'Save configuration');
$this
->drupalGet('node/' . $article
->id() . '/translations');
// Verify that translation uses the admin theme if edit is admin.
$this
->assertSession()
->responseContains('core/themes/claro/css/base/elements.css');
// Turn off admin theme for editing, assert inheritance to translations.
$edit['use_admin_theme'] = FALSE;
$this
->drupalGet('admin/appearance');
$this
->submitForm($edit, 'Save configuration');
$this
->drupalGet('node/' . $article
->id() . '/translations');
// Verify that translation uses the frontend theme if edit is frontend.
$this
->assertSession()
->responseNotContains('core/themes/claro/css/base/elements.css');
// Assert presence of translation page itself (vs. DisabledBundle below).
$this
->assertSession()
->statusCodeEquals(200);
}