You are here

public function FileUpdateTest::testPostUpdate8001 in Drupal 8

Tests file_update_8001().

File

core/modules/file/tests/src/Functional/Update/FileUpdateTest.php, line 32

Class

FileUpdateTest
Tests File update path.

Namespace

Drupal\Tests\file\Functional\Update

Code

public function testPostUpdate8001() {
  $view = 'core.entity_view_display.node.article.default';

  // Check that field_file_generic formatter has no
  // use_description_as_link_text setting.
  $formatter_settings = $this
    ->config($view)
    ->get('content.field_file_generic_2677990.settings');
  $this
    ->assertTrue(!isset($formatter_settings['use_description_as_link_text']));

  // Check that field_file_table formatter has no use_description_as_link_text
  // setting.
  $formatter_settings = $this
    ->config($view)
    ->get('content.field_file_table_2677990.settings');
  $this
    ->assertTrue(!isset($formatter_settings['use_description_as_link_text']));

  // Run updates.
  $this
    ->runUpdates();

  // Check that field_file_generic formatter has a
  // use_description_as_link_text setting which value is TRUE.
  $formatter_settings = $this
    ->config($view)
    ->get('content.field_file_generic_2677990.settings');
  $this
    ->assertEqual($formatter_settings, [
    'use_description_as_link_text' => TRUE,
  ]);

  // Check that field_file_table formatter has a use_description_as_link_text
  // setting which value is FALSE.
  $formatter_settings = $this
    ->config($view)
    ->get('content.field_file_table_2677990.settings');
  $this
    ->assertEqual($formatter_settings, [
    'use_description_as_link_text' => FALSE,
  ]);
}