function MigrateLinkDomainSettingFromRestToHalUpdateTest::testLinkDomainMigratedFromRestSettingsToHalSettings

Tests hal_update_8301().

File

core/modules/hal/tests/src/Functional/Update/MigrateLinkDomainSettingFromRestToHalUpdateTest.php, line 31

Class

MigrateLinkDomainSettingFromRestToHalUpdateTest
'link_domain' is migrated from 'rest.settings' to 'hal.settings'.

Namespace

Drupal\Tests\hal\Functional\Update

Code

public function testLinkDomainMigratedFromRestSettingsToHalSettings() {
    // Make sure we have the expected values before the update.
    $hal_settings = $this->config('hal.settings');
    $this->assertIdentical([], $hal_settings->getRawData());
    $rest_settings = $this->config('rest.settings');
    $this->assertTrue(array_key_exists('link_domain', $rest_settings->getRawData()));
    $this->assertIdentical('http://example.com', $rest_settings->getRawData()['link_domain']);
    $this->runUpdates();
    // Make sure we have the expected values after the update.
    $hal_settings = \Drupal::configFactory()->get('hal.settings');
    $this->assertTrue(array_key_exists('link_domain', $hal_settings->getRawData()));
    $this->assertIdentical('http://example.com', $hal_settings->getRawData()['link_domain']);
    $rest_settings = $this->config('rest.settings');
    $this->assertFalse(array_key_exists('link_domain', $rest_settings->getRawData()));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.