You are here

public function AggregatorUpdateTest::testSourceFeedRequired in Drupal 8

Tests that the 'Source feed' field is required.

See also

aggregator_update_8200()

File

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

Class

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

Namespace

Drupal\Tests\aggregator\Functional\Update

Code

public function testSourceFeedRequired() {

  // Check that the 'fid' field is not required prior to the update.
  $field_definition = \Drupal::entityDefinitionUpdateManager()
    ->getFieldStorageDefinition('fid', 'aggregator_item');
  $this
    ->assertFalse($field_definition
    ->isRequired());

  // Run updates.
  $this
    ->runUpdates();

  // Check that the 'fid' field is now required.
  $field_definition = \Drupal::entityDefinitionUpdateManager()
    ->getFieldStorageDefinition('fid', 'aggregator_item');
  $this
    ->assertTrue($field_definition
    ->isRequired());
}