function AggregatorUpdateTest::testUpdateIntervalDefaultValue

Tests that the 'Update interval' field has a default value.

File

core/modules/aggregator/tests/src/Functional/Update/AggregatorUpdateTest.php, line 45

Class

AggregatorUpdateTest
Tests that node settings are properly updated during database updates.

Namespace

Drupal\Tests\aggregator\Functional\Update

Code

public function testUpdateIntervalDefaultValue() {
  // Check that the 'refresh' field does not have a default value prior to the
  // update.
  $field_definition = \Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('refresh', 'aggregator_feed');
  $this->assertSame([], $field_definition->getDefaultValueLiteral());
  // Run updates.
  $this->runUpdates();
  // Check that the 'refresh' has a default value now.
  $field_definition = \Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('refresh', 'aggregator_feed');
  $this->assertSame([
    [
      'value' => 3600,
    ],
  ], $field_definition->getDefaultValueLiteral());
}

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