Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / field / tests / src / Functional / Update / EntityReferenceHandlerSettingUpdateTest.php
diff --git a/web/core/modules/field/tests/src/Functional/Update/EntityReferenceHandlerSettingUpdateTest.php b/web/core/modules/field/tests/src/Functional/Update/EntityReferenceHandlerSettingUpdateTest.php
new file mode 100644 (file)
index 0000000..0fade37
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+namespace Drupal\Tests\field\Functional\Update;
+
+use Drupal\FunctionalTests\Update\UpdatePathTestBase;
+
+/**
+ * Tests the update for the entity reference 'handler' setting.
+ *
+ * @group field
+ */
+class EntityReferenceHandlerSettingUpdateTest extends UpdatePathTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setDatabaseDumpFiles() {
+    $this->databaseDumpFiles = [
+      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
+    ];
+  }
+
+  /**
+   * Tests field_post_update_entity_reference_handler_setting().
+   *
+   * @see field_post_update_entity_reference_handler_setting()
+   */
+  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');
+  }
+
+}