You are here

public function FieldUpdateTest::testFieldUpdate8001 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/Update/FieldUpdateTest.php \Drupal\field\Tests\Update\FieldUpdateTest::testFieldUpdate8001()

Tests field_update_8001().

See also

field_update_8001()

File

core/modules/field/src/Tests/Update/FieldUpdateTest.php, line 52
Contains \Drupal\field\Tests\Update\FieldUpdateTest.

Class

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

Namespace

Drupal\field\Tests\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));
}