Unverified Commit 2b6be852 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3306938 by Spokje, catch: Restore olivero_post_update_add_olivero_primary_color()

(cherry picked from commit 4413ad76)
parent 31995bc4
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -6,10 +6,10 @@
 */

/**
 * Implements hook_removed_post_updates().
 * Sets the default `base_primary_color` value of Olivero's theme settings.
 */
function olivero_removed_post_updates() {
  return [
    'olivero_post_update_add_olivero_primary_color' => '10.0.0',
  ];
function olivero_post_update_add_olivero_primary_color() {
  \Drupal::configFactory()->getEditable('olivero.settings')
    ->set('base_primary_color', '#1b9ae4')
    ->save();
}
+42 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\olivero\Functional\Update;

use Drupal\FunctionalTests\Update\UpdatePathTestBase;

/**
 * Tests the update path for Olivero.
 *
 * @group Update
 */
class OliveroPostUpdateTest extends UpdatePathTestBase {

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

  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../../modules/system/tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz',
    ];
  }

  /**
   * Tests update hook setting base primary color.
   */
  public function testOliveroPrimaryColorUpdate() {
    $config = $this->config('olivero.settings');
    $this->assertEmpty($config->get('base_primary_color'));

    // Run updates.
    $this->runUpdates();

    $config = $this->config('olivero.settings');
    $this->assertSame('#1b9ae4', $config->get('base_primary_color'));
  }

}