You are here

protected function TermParentsTest::assertParentOption in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentOption()
  2. 10 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentOption()

Asserts that an option in the parent form element of terms exists.

Parameters

string $option: The label of the parent option.

bool $selected: (optional) Whether or not the option should be selected. Defaults to FALSE.

3 calls to TermParentsTest::assertParentOption()
TermParentsTest::doTestEditingSingleParent in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Performs tests that edit terms with a single parent
TermParentsTest::testEditingParents in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Tests editing the parents of existing terms.
TermParentsTest::testEditingParentsWithDisabledFormElement in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Tests specifying parents when creating terms and a disabled parent form.

File

core/modules/taxonomy/tests/src/Functional/TermParentsTest.php, line 285

Class

TermParentsTest
Tests managing taxonomy parents through the user interface.

Namespace

Drupal\Tests\taxonomy\Functional

Code

protected function assertParentOption($option, $selected = FALSE) {
  $option = $this
    ->assertSession()
    ->optionExists('Parent terms', $option);
  if ($selected) {
    $this
      ->assertTrue($option
      ->hasAttribute('selected'));
  }
  else {
    $this
      ->assertFalse($option
      ->hasAttribute('selected'));
  }
}