function TermParentsTest::assertParentOption

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

@internal

Parameters

string $option: The label of the parent option.

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

4 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.
TermParentsTest::testParentFromQuery in core/modules/taxonomy/tests/src/Functional/TermParentsTest.php
Test the term add/edit form with parent query parameter.

File

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

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'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.