You are here

public function ImceSourceTest::testImceSourceEnabled in FileField Sources 8

Tests imce source enabled.

File

tests/src/Functional/ImceSourceTest.php, line 30

Class

ImceSourceTest
Tests the imce source.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

public function testImceSourceEnabled() {
  $this
    ->enableSources([
    'imce' => TRUE,
  ]);
  $file = $this
    ->createPermanentFileEntity();
  $this
    ->uploadFileByImceSource($file
    ->getFileUri(), $file
    ->getFilename(), 0);

  // We can only upload one file on single value field.
  $this
    ->assertNoFieldByXPath('//input[@type="submit"]', t('Select'), t('After uploading a file, "Select" button is no longer displayed.'));
  $this
    ->removeFile($file
    ->getFilename(), 0);

  // Can upload file again.
  $this
    ->assertFieldByXpath('//input[@type="submit"]', t('Select'), 'After clicking the "Remove" button, the "Select" button is displayed.');
}