You are here

public function AggregatorUpdateTest::testUpdateIntervalDefaultValue in Drupal 8

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());
}