You are here

public function FileFieldPathsUpdateTest::testRetroEmpty in File (Field) Paths 8

Test behaviour of Retroactive updates when no updates are needed.

File

tests/src/Functional/FileFieldPathsUpdateTest.php, line 15

Class

FileFieldPathsUpdateTest
Test update functionality.

Namespace

Drupal\Tests\filefield_paths\Functional

Code

public function testRetroEmpty() {

  // Create a File field.
  $field_name = mb_strtolower($this
    ->randomMachineName());
  $this
    ->createFileField($field_name, 'node', $this->contentType);

  // Trigger retroactive updates.
  $edit = [
    'third_party_settings[filefield_paths][retroactive_update]' => TRUE,
  ];
  $this
    ->drupalGet("admin/structure/types/manage/{$this->contentType}/fields/node.{$this->contentType}.{$field_name}");
  $this
    ->submitForm($edit, 'Save settings');

  // Ensure that no errors are thrown.
  // No errors were found.
  $this
    ->assertSession()
    ->pageTextNotContains('The website encountered an unexpected error.');
  $this
    ->assertSession()
    ->pageTextContains("Saved {$field_name} configuration.");
}