You are here

public function EmailWidgetSizeSettingUpdateTest::testFieldPostUpdateEmailWidgetSizeSetting in Drupal 8

Tests field_post_update_email_widget_size_setting().

See also

field_post_update_email_widget_size_setting()

File

core/modules/field/tests/src/Functional/Update/EmailWidgetSizeSettingUpdateTest.php, line 30

Class

EmailWidgetSizeSettingUpdateTest
Tests the update for the 'size' setting of the 'email_default' field widget.

Namespace

Drupal\Tests\field\Functional\Update

Code

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

  // Load the 'node.article.default' entity form display and check that the
  // widget for 'field_email_2578741' does not have a 'size' setting.

  /** @var \Drupal\Core\Config\Config $config */
  $config = $configFactory
    ->get('core.entity_form_display.node.article.default');
  $settings = $config
    ->get('content.field_email_2578741.settings');
  $this
    ->assertTrue(!isset($settings['size']), 'The size setting does not exist prior to running the update functions.');

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

  // Reload the config and check that the 'size' setting has been populated.
  $config = $configFactory
    ->get('core.entity_form_display.node.article.default');
  $settings = $config
    ->get('content.field_email_2578741.settings');
  $this
    ->assertEqual($settings['size'], 60, 'The size setting exists and it has the correct default value.');
}