protected function AssertContentTrait::assertOption in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::assertOption()
Asserts that a select option in the current page exists.
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: use \Drupal\Component\Utility\SafeMarkup::format() to embed variables in the message text, not t(). If left blank, a default message will be displayed.
string $group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Browser'; most tests do not override this default.
Return value
bool TRUE on pass, FALSE on fail.
8 calls to AssertContentTrait::assertOption()
- BlockContentCreationTest::testBlockContentCreationMultipleViewModes in core/
modules/ block_content/ src/ Tests/ BlockContentCreationTest.php - Creates a "Basic page" block with multiple view modes.
- BulkFormTest::testBulkForm in core/
modules/ action/ src/ Tests/ BulkFormTest.php - Tests the bulk form.
- BulkFormTest::testBulkForm in core/
modules/ user/ src/ Tests/ Views/ BulkFormTest.php - Tests the user bulk form.
- CommentNonNodeTest::testsNonIntegerIdEntities in core/
modules/ comment/ src/ Tests/ CommentNonNodeTest.php - Tests comment fields cannot be added to entity types without integer IDs.
- EntityReferenceAdminTest::testFieldAdminHandler in core/
modules/ field/ src/ Tests/ EntityReference/ EntityReferenceAdminTest.php - Tests the Entity Reference Admin UI.
File
- core/
modules/ simpletest/ src/ AssertContentTrait.php, line 1244 - Contains \Drupal\simpletest\AssertContentTrait.
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\simpletestCode
protected function assertOption($id, $option, $message = '', $group = 'Browser') {
$options = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => $id,
':option' => $option,
));
return $this
->assertTrue(isset($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @id exists.', array(
'@option' => $option,
'@id' => $id,
)), $group);
}