You are here

protected function TermParentsTest::assertParentOption in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::assertParentOption()
  2. 9 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.

@internal

Parameters

string $option: The label of the parent option.

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

File

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

Class

TermParentsTest
Tests managing taxonomy parents through the user interface.

Namespace

Drupal\Tests\taxonomy\Functional

Code

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