function ThemeTest::testThemeSettingsLogo

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()
  2. 10 core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()
  3. 11.x core/modules/system/tests/src/Functional/System/ThemeTest.php \Drupal\Tests\system\Functional\System\ThemeTest::testThemeSettingsLogo()

Test the theme settings logo form.

File

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

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->drupalPostForm('admin/appearance/settings/bartik', $edit, t('Save configuration'));
    $this->assertFieldByName('default_logo', FALSE);
    $this->assertFieldByName('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->assertNoText('Logo image settings');
    $this->assertNoText('Shortcut icon settings');
}

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