You are here

public function AttachSourceTest::isOptionPresent in FileField Sources 8

Check to see if a option is present.

Parameters

string $uri: The option to check.

Return value

bool TRUE if the option is present, FALSE otherwise.

2 calls to AttachSourceTest::isOptionPresent()
AttachSourceTest::assertCanAttachFile in tests/src/Functional/AttachSourceTest.php
Check to see if can attach file.
AttachSourceTest::assertCanNotAttachFile in tests/src/Functional/AttachSourceTest.php
Check to see if can attach file.

File

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

Class

AttachSourceTest
Tests the attach source.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

public function isOptionPresent($uri) {
  $options = $this
    ->xpath('//select[@name=:name]/option[@value=:option]', [
    ':name' => $this->fieldName . '[0][filefield_attach][filename]',
    ':option' => $uri,
  ]);
  return isset($options[0]);
}