protected function AssertContentTrait::assertNoOption in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::assertNoOption()
Asserts that a select option in the current page does not exist.
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.
6 calls to AssertContentTrait::assertNoOption()
- 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.
- LocaleTranslationUiTest::testStringTranslation in core/
modules/ locale/ src/ Tests/ LocaleTranslationUiTest.php - Adds a language and tests string translation by users with the appropriate permissions.
- MenuNodeTest::testMenuNodeFormWidget in core/
modules/ menu_ui/ src/ Tests/ MenuNodeTest.php - Test creating, editing, deleting menu links via node form widget.
File
- core/
modules/ simpletest/ src/ AssertContentTrait.php, line 1296 - Contains \Drupal\simpletest\AssertContentTrait.
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\simpletestCode
protected function assertNoOption($id, $option, $message = '', $group = 'Browser') {
$selects = $this
->xpath('//select[@id=:id]', array(
':id' => $id,
));
$options = $this
->xpath('//select[@id=:id]//option[@value=:option]', array(
':id' => $id,
':option' => $option,
));
return $this
->assertTrue(isset($selects[0]) && !isset($options[0]), $message ? $message : SafeMarkup::format('Option @option for field @id does not exist.', array(
'@option' => $option,
'@id' => $id,
)), $group);
}