You are here

public function EntityReferenceHandlerSettingUpdateTest::testFieldPostUpdateERHandlerSetting in Zircon Profile 8

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

Tests field_post_update_entity_reference_handler_setting().

See also

field_post_update_entity_reference_handler_setting()

File

core/modules/field/src/Tests/Update/EntityReferenceHandlerSettingUpdateTest.php, line 33
Contains \Drupal\field\Tests\Update\EntityReferenceHandlerSettingUpdateTest.

Class

EntityReferenceHandlerSettingUpdateTest
Tests the update for the entity reference 'handler' setting.

Namespace

Drupal\field\Tests\Update

Code

public function testFieldPostUpdateERHandlerSetting() {
  $configFactory = $this->container
    ->get('config.factory');

  // Load the 'node.article.field_image' field config, and check that its
  // 'handler' setting is wrong.

  /** @var \Drupal\Core\Config\Config */
  $config = $configFactory
    ->get('field.field.node.article.field_image');
  $settings = $config
    ->get('settings');
  $this
    ->assertEqual($settings['handler'], 'default:node');

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

  // Reload the config, and check that the 'handler' setting has been fixed.
  $config = $configFactory
    ->get('field.field.node.article.field_image');
  $settings = $config
    ->get('settings');
  $this
    ->assertEqual($settings['handler'], 'default:file');
}