function DateRangeFormatterSettingsUpdateTest::testPostUpdateDateRangeFormatter

Tests update path for the 'from_to' formatter setting.

@covers \datetime_range_post_update_from_to_configuration

File

core/modules/datetime_range/tests/src/Functional/DateRangeFormatterSettingsUpdateTest.php, line 45

Class

DateRangeFormatterSettingsUpdateTest
Tests the update path for daterange formatter settings.

Namespace

Drupal\Tests\datetime_range\Functional

Code

public function testPostUpdateDateRangeFormatter() : void {
    $config_factory = \Drupal::configFactory();
    // Check that 'from_to' is missing before update.
    $settings = $config_factory->get('core.entity_view_display.node.page.default')
        ->get('content.field_datetime_range.settings');
    $this->assertArrayNotHasKey('from_to', $settings);
    $this->runUpdates();
    $settings = $config_factory->get('core.entity_view_display.node.page.default')
        ->get('content.field_datetime_range.settings');
    $this->assertArrayHasKey('from_to', $settings);
}

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