FileUpdateTest.php in Drupal 8
File
core/modules/file/tests/src/Functional/Update/FileUpdateTest.php
View source
<?php
namespace Drupal\Tests\file\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class FileUpdateTest extends UpdatePathTestBase {
protected static $modules = [
'file',
];
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../tests/fixtures/update/drupal-8.file_formatters_update_2677990.php',
];
}
public function testPostUpdate8001() {
$view = 'core.entity_view_display.node.article.default';
$formatter_settings = $this
->config($view)
->get('content.field_file_generic_2677990.settings');
$this
->assertTrue(!isset($formatter_settings['use_description_as_link_text']));
$formatter_settings = $this
->config($view)
->get('content.field_file_table_2677990.settings');
$this
->assertTrue(!isset($formatter_settings['use_description_as_link_text']));
$this
->runUpdates();
$formatter_settings = $this
->config($view)
->get('content.field_file_generic_2677990.settings');
$this
->assertEqual($formatter_settings, [
'use_description_as_link_text' => TRUE,
]);
$formatter_settings = $this
->config($view)
->get('content.field_file_table_2677990.settings');
$this
->assertEqual($formatter_settings, [
'use_description_as_link_text' => FALSE,
]);
}
public function testOwnerEntityKey() {
$entity_type = \Drupal::entityDefinitionUpdateManager()
->getEntityType('file');
$this
->assertFalse($entity_type
->getKey('owner'));
$this
->runUpdates();
$entity_type = \Drupal::entityDefinitionUpdateManager()
->getEntityType('file');
$this
->assertEqual('uid', $entity_type
->getKey('owner'));
}
}