function FieldUpdateTest::testFieldUpdate8001

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

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