You are here

public function FieldUpdateTest::testFieldUpdate8001 in Drupal 8

Tests field_update_8001().

See also

field_update_8001()

File

core/modules/field/tests/src/Functional/Update/FieldUpdateTest.php, line 80

Class

FieldUpdateTest
Tests that field settings are properly updated during database updates.

Namespace

Drupal\Tests\field\Functional\Update

Code

public function testFieldUpdate8001() {

  // Load the 'node.field_image' field storage config, and check that is has
  // a 'target_bundle' setting.
  $config = $this->configFactory
    ->get('field.storage.node.field_image');
  $settings = $config
    ->get('settings');
  $this
    ->assertTrue(array_key_exists('target_bundle', $settings));

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

  // Reload the config, and check that the 'target_bundle' setting has been
  // removed.
  $config = $this->configFactory
    ->get('field.storage.node.field_image');
  $settings = $config
    ->get('settings');
  $this
    ->assertFalse(array_key_exists('target_bundle', $settings));
}