You are here

public function ThemeTest::testThemeSettingsLogo in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()

Tests the theme settings logo form.

File

core/modules/system/tests/src/Functional/System/ThemeTest.php, line 233

Class

ThemeTest
Tests the theme interface functionality by enabling and switching themes, and using an administration theme.

Namespace

Drupal\Tests\system\Functional\System

Code

public function testThemeSettingsLogo() {

  // Visit Bartik's theme settings page to replace the logo.
  $this->container
    ->get('theme_installer')
    ->install([
    'bartik',
  ]);
  $this
    ->drupalGet('admin/appearance/settings/bartik');
  $edit = [
    'default_logo' => FALSE,
    'logo_path' => 'core/misc/druplicon.png',
  ];
  $this
    ->drupalGet('admin/appearance/settings/bartik');
  $this
    ->submitForm($edit, 'Save configuration');
  $this
    ->assertSession()
    ->fieldValueEquals('default_logo', FALSE);
  $this
    ->assertSession()
    ->fieldValueEquals('logo_path', 'core/misc/druplicon.png');

  // Make sure the logo and favicon settings are not available when the file
  // module is not enabled.
  \Drupal::service('module_installer')
    ->uninstall([
    'file',
  ]);
  $this
    ->drupalGet('admin/appearance/settings');
  $this
    ->assertSession()
    ->pageTextNotContains('Logo image settings');
  $this
    ->assertSession()
    ->pageTextNotContains('Shortcut icon settings');
}