diff --git a/core/themes/olivero/olivero.post_update.php b/core/themes/olivero/olivero.post_update.php index 902824abab98d1010c660fb849aa5ff2f84e3da2..f033945e02be45f1a74e43d353c25f784c7f398f 100644 --- a/core/themes/olivero/olivero.post_update.php +++ b/core/themes/olivero/olivero.post_update.php @@ -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(); } diff --git a/core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php b/core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..38c1d29930d055c61e0780128946a088820f8ab2 --- /dev/null +++ b/core/themes/olivero/tests/src/Functional/Update/OliveroPostUpdateTest.php @@ -0,0 +1,42 @@ +<?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')); + } + +}