You are here

function FileFieldTestBase::updateFileField in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/FileFieldTestBase.php \Drupal\file\Tests\FileFieldTestBase::updateFileField()

Updates an existing file field with new settings.

5 calls to FileFieldTestBase::updateFileField()
FileFieldPathTest::testUploadPath in core/modules/file/src/Tests/FileFieldPathTest.php
Tests the normal formatter display on node display.
FileFieldValidateTest::testFileExtension in core/modules/file/src/Tests/FileFieldValidateTest.php
Tests file extension checking.
FileFieldValidateTest::testFileMaxSize in core/modules/file/src/Tests/FileFieldValidateTest.php
Tests the max file size validator.
FileFieldValidateTest::testFileRemoval in core/modules/file/src/Tests/FileFieldValidateTest.php
Checks that a file can always be removed if it does not pass validation.
FileFieldWidgetTest::testWidgetValidation in core/modules/file/src/Tests/FileFieldWidgetTest.php
Tests validation with the Upload button.

File

core/modules/file/src/Tests/FileFieldTestBase.php, line 136
Contains \Drupal\file\Tests\FileFieldTestBase.

Class

FileFieldTestBase
Provides methods specifically for testing File module's field handling.

Namespace

Drupal\file\Tests

Code

function updateFileField($name, $type_name, $field_settings = array(), $widget_settings = array()) {
  $field = FieldConfig::loadByName('node', $type_name, $name);
  $field
    ->setSettings(array_merge($field
    ->getSettings(), $field_settings));
  $field
    ->save();
  entity_get_form_display('node', $type_name, 'default')
    ->setComponent($name, array(
    'settings' => $widget_settings,
  ))
    ->save();
}