protected function WebformAssertLegacyTrait::assertOptionSelected in Webform 6.x
Same name and namespace in other branches
- 8.5 tests/src/Traits/WebformAssertLegacyTrait.php \Drupal\Tests\webform\Traits\WebformAssertLegacyTrait::assertOptionSelected()
Asserts that a select option in the current page is checked.
Parameters
string $id: ID of select field to assert.
string $option: Option to assert.
string $message: (optional) A message to display with the assertion. Do not translate messages with t(). If left blank, a default message will be displayed.
4 calls to WebformAssertLegacyTrait::assertOptionSelected()
- WebformElementSubmittedValueTest::testSubmittedValue in tests/
src/ Functional/ Element/ WebformElementSubmittedValueTest.php - Tests submitted value.
- WebformListBuilderTest::testFilter in tests/
src/ Functional/ WebformListBuilderTest.php - Tests the webform overview filter.
- WebformNodeReferencesTest::testReferences in modules/
webform_node/ tests/ src/ Functional/ WebformNodeReferencesTest.php - Tests webform node references.
- WebformVariantOperationsTest::testVariantOperations in tests/
src/ Functional/ Variant/ WebformVariantOperationsTest.php - Test variant operation.
File
- tests/
src/ Traits/ WebformAssertLegacyTrait.php, line 461
Class
- WebformAssertLegacyTrait
- Provides convenience methods for assertions in browser tests.
Namespace
Drupal\Tests\webform\TraitsCode
protected function assertOptionSelected($id, $option, $message = NULL) {
$option_field = $this
->assertSession()
->optionExists($id, $option);
$message = $message ?: "Option {$option} for field {$id} is selected.";
$this
->assertTrue($option_field
->hasAttribute('selected'), $message);
}