34f4b88c1c39237947149c5f0d2d33419348ca67
[yaffs-website] / web / core / modules / hal / tests / src / Functional / Update / MigrateLinkDomainSettingFromRestToHalUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\hal\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * 'link_domain' is migrated from 'rest.settings' to 'hal.settings'.
9  *
10  * @see https://www.drupal.org/node/2758897
11  *
12  * @group hal
13  * @group legacy
14  */
15 class MigrateLinkDomainSettingFromRestToHalUpdateTest extends UpdatePathTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   public function setDatabaseDumpFiles() {
21     $this->databaseDumpFiles = [
22       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
23       __DIR__ . '/../../../fixtures/update/drupal-8.hal-hal_update_8301.php',
24       __DIR__ . '/../../../fixtures/update/drupal-8.rest-hal_update_8301.php',
25     ];
26   }
27
28   /**
29    * Tests hal_update_8301().
30    */
31   public function testLinkDomainMigratedFromRestSettingsToHalSettings() {
32     // Make sure we have the expected values before the update.
33     $hal_settings = $this->config('hal.settings');
34     $this->assertIdentical([], $hal_settings->getRawData());
35     $rest_settings = $this->config('rest.settings');
36     $this->assertTrue(array_key_exists('link_domain', $rest_settings->getRawData()));
37     $this->assertIdentical('http://example.com', $rest_settings->getRawData()['link_domain']);
38
39     $this->runUpdates();
40
41     // Make sure we have the expected values after the update.
42     $hal_settings = \Drupal::configFactory()->get('hal.settings');
43     $this->assertTrue(array_key_exists('link_domain', $hal_settings->getRawData()));
44     $this->assertIdentical('http://example.com', $hal_settings->getRawData()['link_domain']);
45     $rest_settings = $this->config('rest.settings');
46     $this->assertFalse(array_key_exists('link_domain', $rest_settings->getRawData()));
47   }
48
49 }