Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / file / tests / src / Functional / Update / FileUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\file\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests File update path.
9  *
10  * @group legacy
11  */
12 class FileUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * Modules to enable after the database is loaded.
16    */
17   protected static $modules = ['file'];
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function setDatabaseDumpFiles() {
23     $this->databaseDumpFiles = [
24       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
25       __DIR__ . '/../../../../tests/fixtures/update/drupal-8.file_formatters_update_2677990.php',
26     ];
27   }
28
29   /**
30    * Tests file_update_8001().
31    */
32   public function testPostUpdate8001() {
33     $view = 'core.entity_view_display.node.article.default';
34
35     // Check that field_file_generic formatter has no
36     // use_description_as_link_text setting.
37     $formatter_settings = $this->config($view)->get('content.field_file_generic_2677990.settings');
38     $this->assertTrue(!isset($formatter_settings['use_description_as_link_text']));
39
40     // Check that field_file_table formatter has no use_description_as_link_text
41     // setting.
42     $formatter_settings = $this->config($view)->get('content.field_file_table_2677990.settings');
43     $this->assertTrue(!isset($formatter_settings['use_description_as_link_text']));
44
45     // Run updates.
46     $this->runUpdates();
47
48     // Check that field_file_generic formatter has a
49     // use_description_as_link_text setting which value is TRUE.
50     $formatter_settings = $this->config($view)->get('content.field_file_generic_2677990.settings');
51     $this->assertEqual($formatter_settings, ['use_description_as_link_text' => TRUE]);
52
53     // Check that field_file_table formatter has a use_description_as_link_text
54     // setting which value is FALSE.
55     $formatter_settings = $this->config($view)->get('content.field_file_table_2677990.settings');
56     $this->assertEqual($formatter_settings, ['use_description_as_link_text' => FALSE]);
57   }
58
59 }