Commit 15873552 authored by catch's avatar catch
Browse files

Issue #3281434 by Spokje, Vighneshh, quietone, longwave, catch, nod_,...

Issue #3281434 by Spokje, Vighneshh, quietone, longwave, catch, nod_, deviantintegral, guptahemant, smustgrave: Update System module tests to not use Bartik and Seven
parent ac66f174
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
@@ -285,11 +285,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');
@@ -306,7 +306,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());
@@ -314,11 +314,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 = [
@@ -333,7 +333,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']);
@@ -341,7 +341,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.
@@ -420,25 +420,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.
@@ -451,8 +450,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');
@@ -467,12 +466,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();
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public function testUpdate() {
      'checksum' => 0,
    ];
    $insert->fields($fields);
    $fields['cid'] = 'element_info_build:seven';
    $fields['cid'] = 'element_info_build:claro';
    $fields['tags'] = 'element_info_build';
    $insert->values(array_values($fields));
    $fields['cid'] = 'element_info_build:stark';
@@ -56,7 +56,7 @@ public function testUpdate() {
    $this->runUpdates();
    // Caches should have been cleared at this point.
    $count = (int) $connection->select('cache_discovery')
      ->condition('cid', ['element_info', 'element_info_build:seven', 'element_info_build:stark'], 'IN')
      ->condition('cid', ['element_info', 'element_info_build:claro', 'element_info_build:stark'], 'IN')
      ->countQuery()
      ->execute()
      ->fetchField();
Loading