function AssertLegacyTrait::assertOptionByText

Same name in other branches
  1. 9 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertOptionByText()

Asserts that a select option with the visible text exists.

Parameters

string $id: The ID of the select field to assert.

string $text: The text for the option tag to assert.

Deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use $this->assertSession()->optionExists() instead.

1 call to AssertLegacyTrait::assertOptionByText()
BrowserTestBaseTest::testFieldAssertsForOptions in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy field asserts for options field type.

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 467

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertOptionByText($id, $text) {
    return $this->assertSession()
        ->optionExists($id, $text);
}

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