diff --git a/core/modules/field/src/Tests/Update/NumberFieldUpdateTest.php b/core/modules/field/src/Tests/Update/NumberFieldUpdateTest.php index 97986f4..842e006 100644 --- a/core/modules/field/src/Tests/Update/NumberFieldUpdateTest.php +++ b/core/modules/field/src/Tests/Update/NumberFieldUpdateTest.php @@ -53,7 +53,7 @@ public function testUpdateHookN() { // and since this was not optional prior to this update, it should be // set to TRUE. $config = \Drupal::config('core.entity_form_display.node.number_test.default')->get(); - $this->assertTrue($config['content']['field_test_int']['format_plural']); + $this->assertTrue($config['content']['field_test_int']['settings']['format_plural']); // View mode configuration - should be migrated from prefix_suffix TRUE to // format_plural 'field'. diff --git a/core/modules/system/tests/fixtures/update/drupal-8.core.entity_form_display.node.number_test.default-2545730.yml b/core/modules/system/tests/fixtures/update/drupal-8.core.entity_form_display.node.number_test.default-2545730.yml index ca5b52c..d21bbee 100644 --- a/core/modules/system/tests/fixtures/update/drupal-8.core.entity_form_display.node.number_test.default-2545730.yml +++ b/core/modules/system/tests/fixtures/update/drupal-8.core.entity_form_display.node.number_test.default-2545730.yml @@ -2,7 +2,6 @@ langcode: en status: true dependencies: config: - - field.field.node.number_test.body - field.field.node.number_test.field_test_int - node.type.number_test module: @@ -13,14 +12,6 @@ targetEntityType: node bundle: number_test mode: default content: - body: - type: text_textarea_with_summary - weight: 31 - settings: - rows: 9 - summary_rows: 3 - placeholder: '' - third_party_settings: { } created: type: datetime_timestamp weight: 10 diff --git a/core/modules/system/tests/fixtures/update/drupal-8.core.entity_view_display.node.number_test.default-2545730.yml b/core/modules/system/tests/fixtures/update/drupal-8.core.entity_view_display.node.number_test.default-2545730.yml index b017a38..27c99e8 100644 --- a/core/modules/system/tests/fixtures/update/drupal-8.core.entity_view_display.node.number_test.default-2545730.yml +++ b/core/modules/system/tests/fixtures/update/drupal-8.core.entity_view_display.node.number_test.default-2545730.yml @@ -2,7 +2,6 @@ langcode: en status: true dependencies: config: - - field.field.node.number_test.body - field.field.node.number_test.field_test_int - node.type.number_test module: @@ -13,12 +12,6 @@ targetEntityType: node bundle: number_test mode: default content: - body: - label: hidden - type: text_default - weight: 101 - settings: { } - third_party_settings: { } field_test_int: weight: 102 label: above diff --git a/core/modules/system/tests/fixtures/update/drupal-8.numeric-field-data-2545730.php b/core/modules/system/tests/fixtures/update/drupal-8.numeric-field-data-2545730.php index 818cc95..83a40ab 100644 --- a/core/modules/system/tests/fixtures/update/drupal-8.numeric-field-data-2545730.php +++ b/core/modules/system/tests/fixtures/update/drupal-8.numeric-field-data-2545730.php @@ -11,20 +11,19 @@ $connection = Database::getConnection(); // Define a complete set of configurations, with dependencies. -// Note that field.storage.node.body exists in the default database. $configs = [ 'core.entity_form_display.node.number_test.default', 'core.entity_view_display.node.number_test.default', - 'field.field.node.number_test.body', 'field.field.node.number_test.field_test_int', 'field.storage.node.field_test_int', 'node.type.number_test', 'views.view.number_test', ]; +$data = []; foreach ($configs as $config) { $file = 'drupal-8.' . $config . '-2545730.yml'; - $data = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/' . $file)); + $data[$config] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/' . $file)); $connection->insert('config') ->fields(array( 'collection', @@ -34,7 +33,57 @@ ->values(array( 'collection' => '', 'name' => $config, - 'data' => serialize($data), + 'data' => serialize($data[$config]), )) ->execute(); } + +// Create the field database tables. Don't bother with descriptions or +// indexes, since we're not actually putting data into them. +$schema = $connection->schema(); +$common_fields = [ + 'bundle' => [ + 'type' => 'varchar', + 'length' => 128, + ], + 'deleted' => [ + 'type' => 'int', + 'length' => 4, + ], + 'entity_id' => [ + 'type' => 'int', + 'length' => 10, + ], + 'revision_id' => [ + 'type' => 'int', + 'length' => 10, + ], + 'langcode' => [ + 'type' => 'varchar', + 'length' => 32, + ], + 'delta' => [ + 'type' => 'int', + 'length' => 10, + ], +]; + +$schema->createTable('node_revision__field_test_int', [ 'fields' => $common_fields, ]); +$schema->createTable('node__field_test_int', [ 'fields' => $common_fields, ]); + +// Tell Drupal this field has been installed, or it will think it has been +// deleted. Normally you'd want to use \Drupal::keyValue() to do this, but +// you cannot use this service at this point in the update test. So set the +// value in the database directly. +$definitions = unserialize($connection->select('key_value') + ->fields(array('value')) + ->condition('collection', 'entity.definitions.installed') + ->condition('name', 'node.field_storage_definitions') + ->execute() + ->fetchValue()); +$definitions['field_test_int'] = $data['field.storage.node.field_test_int']; +$connection->update('key_value') + ->condition('collection', 'entity.definitions.installed') + ->condition('name', 'node.field_storage_definitions') + ->fields('value' => serialize($definitions)) + ->execute();