function ThemeTest::testThemeSettingsLogo

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()
  2. 8.9.x core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()
  3. 10 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 258

Class

ThemeTest
Tests the theme administration user interface.

Namespace

Drupal\Tests\system\Functional\System

Code

public function testThemeSettingsLogo() : void {
    // Visit Olivero's theme settings page to replace the logo.
    $this->container
        ->get('theme_installer')
        ->install([
        'olivero',
    ]);
    $this->drupalGet('admin/appearance/settings/olivero');
    $edit = [
        'default_logo' => FALSE,
        'logo_path' => 'core/misc/druplicon.png',
    ];
    $this->drupalGet('admin/appearance/settings/olivero');
    $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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.