protected function AssertContentTrait::assertFieldById in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::assertFieldById()
Asserts that a field exists with the given ID and value.
Parameters
string $id: ID of field to assert.
string|\Drupal\Component\Render\MarkupInterface $value: (optional) Value for the field to assert. You may pass in NULL to skip checking the value, while still checking that the field exists. However, the default value ('') asserts that the field value is an empty string.
string|\Drupal\Component\Render\MarkupInterface $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.
20 calls to AssertContentTrait::assertFieldById()
- BooleanFieldTest::testBooleanField in core/
modules/ field/ src/ Tests/ Boolean/ BooleanFieldTest.php - Tests boolean field.
- BulkFormTest::testBulkForm in core/
modules/ action/ src/ Tests/ BulkFormTest.php - Tests the bulk form.
- CachedDataUITest::testCacheData in core/
modules/ views_ui/ src/ Tests/ CachedDataUITest.php - Tests the user tempstore views data in the UI.
- CommentAdminTest::testEditComment in core/
modules/ comment/ src/ Tests/ CommentAdminTest.php - Tests editing a comment as an admin.
- ConfigExportUITest::testExport in core/
modules/ config/ src/ Tests/ ConfigExportUITest.php - Tests export of configuration.
File
- core/
modules/ simpletest/ src/ AssertContentTrait.php, line 1138 - Contains \Drupal\simpletest\AssertContentTrait.
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\simpletestCode
protected function assertFieldById($id, $value = '', $message = '', $group = 'Browser') {
// Cast MarkupInterface objects to string.
if (isset($value)) {
$value = (string) $value;
}
$message = (string) $message;
return $this
->assertFieldByXPath($this
->constructFieldXpath('id', $id), $value, $message ? $message : SafeMarkup::format('Found field by id @id', array(
'@id' => $id,
)), $group);
}