From 4a13614a2ae82d093c5f3661df39070b5a5af558 Mon Sep 17 00:00:00 2001 From: Jennifer Hodgdon <yahgrp@poplarware.com> Date: Tue, 17 Jun 2014 08:43:47 -0700 Subject: [PATCH] Issue #2039449 by joshi.rohit100, joachim, lokapujya, Jalandhar, paulh, yaworsk: Fix docs for assertField methods in WebTestBase to describe how to skip value checking --- core/modules/simpletest/src/WebTestBase.php | 58 +++++++++++++-------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 347ddb3ed7f2..9bf6c23e0b65 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -404,7 +404,7 @@ protected function drupalBuildEntityView(EntityInterface $entity, $view_mode = ' * @endcode * The following defaults are provided: * - label: Random string. - * - id: Random string. + * - ID: Random string. * - region: 'sidebar_first'. * - theme: The default theme. * - visibility: Empty array. @@ -3147,7 +3147,9 @@ protected function assertThemeOutput($callback, array $variables = array(), $exp * @param $xpath * XPath used to find the field. * @param $value - * (optional) Value of the field to assert. + * (optional) Value of the field to assert. You may pass in NULL (default) + * to skip checking the actual value, while still checking that the field + * exists. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3222,12 +3224,13 @@ protected function getSelectedItem(\SimpleXMLElement $element) { } /** - * Asserts that a field does not exist in the current page by the given XPath. + * Asserts that a field doesn't exist or its value doesn't match, by XPath. * * @param $xpath * XPath used to find the field. * @param $value - * (optional) Value of the field to assert. + * (optional) Value for the field, to assert that the field's value on the + * page doesn't match it. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3265,7 +3268,9 @@ protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '', $g * @param $name * Name of field to assert. * @param $value - * Value of the field to assert. + * (optional) Value of the field to assert. You may pass in NULL (default) + * to skip checking the actual value, while still checking that the field + * exists. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3302,7 +3307,10 @@ protected function assertFieldByName($name, $value = NULL, $message = NULL, $gro * @param $name * Name of field to assert. * @param $value - * Value of the field to assert. + * (optional) Value for the field, to assert that the field's value on the + * page doesn't match it. You may pass in NULL to skip checking the + * value, while still checking that the field doesn't exist. However, the + * default value ('') asserts that the field value is not an empty string. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3321,12 +3329,15 @@ protected function assertNoFieldByName($name, $value = '', $message = '', $group } /** - * Asserts that a field exists with the given id and value. + * Asserts that a field exists with the given ID and value. * * @param $id - * Id of field to assert. + * ID of field to assert. * @param $value - * Value of the field to assert. + * (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. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3345,12 +3356,15 @@ protected function assertFieldById($id, $value = '', $message = '', $group = 'Br } /** - * Asserts that a field does not exist with the given id and value. + * Asserts that a field does not exist with the given ID and value. * * @param $id - * Id of field to assert. + * ID of field to assert. * @param $value - * Value of the field to assert. + * (optional) Value for the field, to assert that the field's value on the + * page doesn't match it. You may pass in NULL to skip checking the value, + * while still checking that the field doesn't exist. However, the default + * value ('') asserts that the field value is not an empty string. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3372,7 +3386,7 @@ protected function assertNoFieldById($id, $value = '', $message = '', $group = ' * Asserts that a checkbox field in the current page is checked. * * @param $id - * Id of field to assert. + * ID of field to assert. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3395,7 +3409,7 @@ protected function assertFieldChecked($id, $message = '', $group = 'Browser') { * Asserts that a checkbox field in the current page is not checked. * * @param $id - * Id of field to assert. + * ID of field to assert. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3418,7 +3432,7 @@ protected function assertNoFieldChecked($id, $message = '', $group = 'Browser') * Asserts that a select option in the current page exists. * * @param $id - * Id of select field to assert. + * ID of select field to assert. * @param $option * Option to assert. * @param $message @@ -3443,7 +3457,7 @@ protected function assertOption($id, $option, $message = '', $group = 'Browser') * Asserts that a select option in the current page does not exist. * * @param $id - * Id of select field to assert. + * ID of select field to assert. * @param $option * Option to assert. * @param $message @@ -3469,7 +3483,7 @@ protected function assertNoOption($id, $option, $message = '', $group = 'Browser * Asserts that a select option in the current page is checked. * * @param $id - * Id of select field to assert. + * ID of select field to assert. * @param $option * Option to assert. * @param $message @@ -3496,7 +3510,7 @@ protected function assertOptionSelected($id, $option, $message = '', $group = 'B * Asserts that a select option in the current page is not checked. * * @param $id - * Id of select field to assert. + * ID of select field to assert. * @param $option * Option to assert. * @param $message @@ -3518,10 +3532,10 @@ protected function assertNoOptionSelected($id, $option, $message = '', $group = } /** - * Asserts that a field exists with the given name or id. + * Asserts that a field exists with the given name or ID. * * @param $field - * Name or id of field to assert. + * Name or ID of field to assert. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not @@ -3540,10 +3554,10 @@ protected function assertField($field, $message = '', $group = 'Other') { } /** - * Asserts that a field does not exist with the given name or id. + * Asserts that a field does not exist with the given name or ID. * * @param $field - * Name or id of field to assert. + * Name or ID of field to assert. * @param $message * (optional) A message to display with the assertion. Do not translate * messages: use format_string() to embed variables in the message text, not -- GitLab