db backup prior to drupal security update
[yaffs-website] / web / core / modules / field / src / Tests / Update / EntityReferenceHandlerSettingUpdateTest.php
1 <?php
2
3 namespace Drupal\field\Tests\Update;
4
5 use Drupal\system\Tests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests the update for the entity reference 'handler' setting.
9  *
10  * @group field
11  */
12 class EntityReferenceHandlerSettingUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function setDatabaseDumpFiles() {
18     $this->databaseDumpFiles = [
19       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
20     ];
21   }
22
23   /**
24    * Tests field_post_update_entity_reference_handler_setting().
25    *
26    * @see field_post_update_entity_reference_handler_setting()
27    */
28   public function testFieldPostUpdateERHandlerSetting() {
29     $configFactory = $this->container->get('config.factory');
30
31     // Load the 'node.article.field_image' field config, and check that its
32     // 'handler' setting is wrong.
33     /** @var \Drupal\Core\Config\Config */
34     $config = $configFactory->get('field.field.node.article.field_image');
35     $settings = $config->get('settings');
36     $this->assertEqual($settings['handler'], 'default:node');
37
38     // Run updates.
39     $this->runUpdates();
40
41     // Reload the config, and check that the 'handler' setting has been fixed.
42     $config = $configFactory->get('field.field.node.article.field_image');
43     $settings = $config->get('settings');
44     $this->assertEqual($settings['handler'], 'default:file');
45   }
46
47 }