Loading core/themes/olivero/olivero.post_update.php +5 −5 Original line number Diff line number Diff line Loading @@ -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(); } core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php 0 → 100644 +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')); } } Loading
core/themes/olivero/olivero.post_update.php +5 −5 Original line number Diff line number Diff line Loading @@ -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(); }
core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php 0 → 100644 +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')); } }