You are here

ColorConfigSchemaTest.php in Drupal 9

Same filename and directory in other branches
  1. 8 core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php

File

core/modules/color/tests/src/Functional/ColorConfigSchemaTest.php
View source
<?php

namespace Drupal\Tests\color\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Ensures the color config schema is correct.
 *
 * @group color
 */
class ColorConfigSchemaTest extends BrowserTestBase {

  /**
   * Modules to install.
   *
   * @var array
   */
  protected static $modules = [
    'color',
  ];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * A user with administrative permissions.
   *
   * @var \Drupal\user\UserInterface
   */
  protected $adminUser;

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    \Drupal::service('theme_installer')
      ->install([
      'bartik',
    ]);

    // Create user.
    $this->adminUser = $this
      ->drupalCreateUser([
      'administer themes',
    ]);
    $this
      ->drupalLogin($this->adminUser);
  }

  /**
   * Tests whether the color config schema is valid.
   */
  public function testValidColorConfigSchema() {
    $settings_path = 'admin/appearance/settings/bartik';
    $edit['scheme'] = '';
    $edit['palette[bg]'] = '#123456';
    $this
      ->drupalGet($settings_path);
    $this
      ->submitForm($edit, 'Save configuration');
  }

}

Classes

Namesort descending Description
ColorConfigSchemaTest Ensures the color config schema is correct.