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