Commit 0444b520 authored by catch's avatar catch
Browse files

Issue #3281434 by Vighneshh, Spokje, quietone, deviantintegral, nod_,...

Issue #3281434 by Vighneshh, Spokje, quietone, deviantintegral, nod_, guptahemant: Update System module tests to not use Bartik and Seven
parent 5c444d0c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -156,10 +156,10 @@ protected function assertOffCanvasBlockFormIsValid() {
   * {@inheritdoc}
   */
  protected function getTestThemes() {
    // Remove 'seven' theme. Settings Tray "Edit Mode" will not work with
    // 'seven' because it removes all contextual links.
    // Remove 'claro' theme. Settings Tray "Edit Mode" will not work with this
    // theme because it removes all contextual links.
    return array_filter(parent::getTestThemes(), function ($theme) {
      return $theme !== 'seven';
      return ($theme !== 'claro');
    });
  }

+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class ImageLazyLoadController extends ControllerBase {
  public function renderImage() {
    $images['with-dimensions'] = [
      '#theme' => 'image',
      '#uri' => '/core/themes/bartik/logo.svg',
      '#uri' => '/core/themes/olivero/logo.svg',
      '#alt' => 'Image lazy load testing image',
      '#prefix' => '<div id="with-dimensions">',
      '#suffix' => '</div>',
@@ -28,7 +28,7 @@ public function renderImage() {

    $images['without-dimensions'] = [
      '#theme' => 'image',
      '#uri' => '/core/themes/bartik/logo.svg',
      '#uri' => '/core/themes/olivero/logo.svg',
      '#alt' => 'Image lazy load testing image without dimensions',
      '#prefix' => '<div id="without-dimensions">',
      '#suffix' => '</div>',
@@ -36,7 +36,7 @@ public function renderImage() {

    $images['override-loading-attribute'] = [
      '#theme' => 'image',
      '#uri' => '/core/themes/bartik/logo.svg',
      '#uri' => '/core/themes/olivero/logo.svg',
      '#alt' => 'Image lazy load test loading attribute can be overridden',
      '#prefix' => '<div id="override-loading-attribute">',
      '#suffix' => '</div>',
+22 −24
Original line number Diff line number Diff line
@@ -286,11 +286,11 @@ public function testThemeSettingsRenderCacheClear() {
   * Tests the administration theme functionality.
   */
  public function testAdministrationTheme() {
    $this->container->get('theme_installer')->install(['seven']);
    $this->container->get('theme_installer')->install(['claro']);

    // Install an administration theme and show it on the node admin pages.
    $edit = [
      'admin_theme' => 'seven',
      'admin_theme' => 'claro',
      'use_admin_theme' => TRUE,
    ];
    $this->drupalGet('admin/appearance');
@@ -307,7 +307,7 @@ public function testAdministrationTheme() {

    // Check that the administration theme is used on an administration page.
    $this->drupalGet('admin/config');
    $this->assertSession()->responseContains('core/themes/seven');
    $this->assertSession()->responseContains('core/themes/claro');

    // Check that the site default theme used on node page.
    $this->drupalGet('node/' . $this->node->id());
@@ -315,11 +315,11 @@ public function testAdministrationTheme() {

    // Check that the administration theme is used on the add content page.
    $this->drupalGet('node/add');
    $this->assertSession()->responseContains('core/themes/seven');
    $this->assertSession()->responseContains('core/themes/claro');

    // Check that the administration theme is used on the edit content page.
    $this->drupalGet('node/' . $this->node->id() . '/edit');
    $this->assertSession()->responseContains('core/themes/seven');
    $this->assertSession()->responseContains('core/themes/claro');

    // Disable the admin theme on the node admin pages.
    $edit = [
@@ -334,7 +334,7 @@ public function testAdministrationTheme() {

    // Check that the administration theme is used on an administration page.
    $this->drupalGet('admin/config');
    $this->assertSession()->responseContains('core/themes/seven');
    $this->assertSession()->responseContains('core/themes/claro');

    // Ensure that the admin theme is also visible on the 403 page.
    $normal_user = $this->drupalCreateUser(['view the administration theme']);
@@ -342,7 +342,7 @@ public function testAdministrationTheme() {
    // Check that the administration theme is used on an administration page.
    $this->drupalGet('admin/config');
    $this->assertSession()->statusCodeEquals(403);
    $this->assertSession()->responseContains('core/themes/seven');
    $this->assertSession()->responseContains('core/themes/claro');
    $this->drupalLogin($this->adminUser);

    // Check that the site default theme used on the add content page.
@@ -421,25 +421,24 @@ public function testInvalidTheme() {
   * Tests uninstalling of themes works.
   */
  public function testUninstallingThemes() {
    // Install Olivero and set it as the default theme.
    // Install olivero.
    \Drupal::service('theme_installer')->install(['olivero']);
    // Set up seven as the admin theme.
    \Drupal::service('theme_installer')->install(['seven']);
    // Set up claro as the admin theme.
    \Drupal::service('theme_installer')->install(['claro']);
    $edit = [
      'admin_theme' => 'seven',
      'admin_theme' => 'claro',
      'use_admin_theme' => TRUE,
    ];
    $this->drupalGet('admin/appearance');
    $this->submitForm($edit, 'Save configuration');
    $this->drupalGet('admin/appearance');
    $this->clickLink('Set as default');

    // Check that seven cannot be uninstalled as it is the admin theme.
    $this->assertSession()->responseNotContains('Uninstall Seven theme');
    // Set olivero as the default theme.
    $this->cssSelect('a[title="Set Olivero as default theme"]')[0]->click();
    // Check that claro cannot be uninstalled as it is the admin theme.
    $this->assertSession()->responseNotContains('Uninstall claro theme');
    // Check that olivero cannot be uninstalled as it is the default theme.
    $this->assertSession()->responseNotContains('Uninstall Olivero theme');
    // Check that the classy theme cannot be uninstalled as it is a base theme
    // of seven and olivero.
    // of claro and olivero.
    $this->assertSession()->responseNotContains('Uninstall Classy theme');

    // Install Stark and set it as the default theme.
@@ -452,8 +451,8 @@ public function testUninstallingThemes() {
    $this->drupalGet('admin/appearance');
    $this->submitForm($edit, 'Save configuration');

    // Check that seven can be uninstalled now.
    $this->assertSession()->responseContains('Uninstall Seven theme');
    // Check that claro can be uninstalled now.
    $this->assertSession()->responseContains('Uninstall claro theme');
    // Check that the classy theme still cannot be uninstalled as it is a
    // base theme of olivero.
    $this->assertSession()->responseNotContains('Uninstall Classy theme');
@@ -468,12 +467,11 @@ public function testUninstallingThemes() {
    // base themes have been.
    $this->assertSession()->responseNotContains('Uninstall Classy theme');

    // Uninstall each of the three themes starting with Olivero.
    $this->clickLink('Uninstall');
    // Uninstall each of the two themes starting with Olivero.
    $this->cssSelect('a[title="Uninstall Olivero theme"]')[0]->click();
    $this->assertSession()->responseContains('The <em class="placeholder">Olivero</em> theme has been uninstalled');
    // Seven is the second in the list.
    $this->clickLink('Uninstall');
    $this->assertSession()->responseContains('The <em class="placeholder">Seven</em> theme has been uninstalled');
    $this->cssSelect('a[title="Uninstall Claro theme"]')[0]->click();
    $this->assertSession()->responseContains('The <em class="placeholder">Claro</em> theme has been uninstalled');

    // Check that the classy theme still can't be uninstalled as it is hidden.
    $this->assertSession()->responseNotContains('Uninstall Classy theme');
+4 −4
Original line number Diff line number Diff line
@@ -46,11 +46,11 @@ public function testThemeToken() {
    $settings = $this->getDrupalSettings();
    $this->assertNull($settings['ajaxPageState']['theme_token']);

    // Install 'seven' and configure it as administrative theme.
    $this->container->get('theme_installer')->install(['seven']);
    $this->config('system.theme')->set('admin', 'seven')->save();
    // Install 'claro' and configure it as administrative theme.
    $this->container->get('theme_installer')->install(['claro']);
    $this->config('system.theme')->set('admin', 'claro')->save();

    // Revisit the page. This time the page is displayed using the 'seven' theme
    // Revisit the page. This time the page is displayed using the 'claro' theme
    // and that is different from the default theme ('classy').
    $this->drupalGet('admin/structure/block');
    $settings = $this->getDrupalSettings();
Loading