You are here

public function AttachSourceTest::assertCanAttachFile in FileField Sources 8

Check to see if can attach file.

Parameters

object $file: File to attach.

2 calls to AttachSourceTest::assertCanAttachFile()
AttachSourceTest::fileCanBeUploadAndDeleted in tests/src/Functional/AttachSourceTest.php
AttachSourceTest::testCopyFileFromAbsolutePath in tests/src/Functional/AttachSourceTest.php
Tests copy file from absolute path.

File

tests/src/Functional/AttachSourceTest.php, line 94

Class

AttachSourceTest
Tests the attach source.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

public function assertCanAttachFile($file) {

  // Ensure option is present.
  $this
    ->assertTrue($this
    ->isOptionPresent($file->uri), 'File option is present.');

  // Ensure empty message is not present.
  $this
    ->assertNoText('There currently are no files to attach.', "Empty message is not present.");

  // Attach button is always present.
  $this
    ->assertFieldByXpath('//input[@type="submit"]', t('Attach'), 'Attach button is present.');
}