344caf1e1cfc0ca7da2abd937c97fe9f8172f1fc
[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  */
14 class MigrateLinkDomainSettingFromRestToHalUpdateTest extends UpdatePathTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function setDatabaseDumpFiles() {
20     $this->databaseDumpFiles = [
21       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
22       __DIR__ . '/../../../fixtures/update/drupal-8.hal-hal_update_8301.php',
23       __DIR__ . '/../../../fixtures/update/drupal-8.rest-hal_update_8301.php',
24     ];
25   }
26
27   /**
28    * Tests hal_update_8301().
29    */
30   public function testLinkDomainMigratedFromRestSettingsToHalSettings() {
31     // Make sure we have the expected values before the update.
32     $hal_settings = $this->config('hal.settings');
33     $this->assertIdentical([], $hal_settings->getRawData());
34     $rest_settings = $this->config('rest.settings');
35     $this->assertTrue(array_key_exists('link_domain', $rest_settings->getRawData()));
36     $this->assertIdentical('http://example.com', $rest_settings->getRawData()['link_domain']);
37
38     $this->runUpdates();
39
40     // Make sure we have the expected values after the update.
41     $hal_settings = \Drupal::configFactory()->get('hal.settings');
42     $this->assertTrue(array_key_exists('link_domain', $hal_settings->getRawData()));
43     $this->assertIdentical('http://example.com', $hal_settings->getRawData()['link_domain']);
44     $rest_settings = $this->config('rest.settings');
45     $this->assertFalse(array_key_exists('link_domain', $rest_settings->getRawData()));
46   }
47
48 }