function FieldUpdateTest::testFieldUpdate8003

Tests field_update_8003().

See also

field_update_8003()

File

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

Class

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

Namespace

Drupal\Tests\field\Functional\Update

Code

public function testFieldUpdate8003() {
    // Run updates.
    $this->runUpdates();
    // Check that the new 'auto_create_bundle' setting is populated correctly.
    $field = $this->configFactory
        ->get('field.field.node.article.field_ref_autocreate_2412569');
    $handler_settings = $field->get('settings.handler_settings');
    $expected_target_bundles = [
        'tags' => 'tags',
        'test' => 'test',
    ];
    $this->assertEqual($handler_settings['target_bundles'], $expected_target_bundles);
    $this->assertTrue($handler_settings['auto_create']);
    $this->assertEqual($handler_settings['auto_create_bundle'], 'tags');
}

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