Problem/Motivation
Checking to see how 'groups' should be used in SimpleTests, I found a few inconsistencies in the comments, whether or not $group
appears as a parameter in function definitions and whether or not it has a default.
Examples:
* @param $group
* The group this message belongs to.
* @param $be_unique
* TRUE if this text should be found only once, FALSE if it should be found more than once.
* @return
* TRUE on pass, FALSE on fail.
*/
protected function assertUniqueTextHelper($text, $message = '', $group, $be_unique) {
* @param $expected
* The expected themed output string.
* @param $message
* (optional) An assertion message.
*/
protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '') {
and even:
* @param $message
* Message to display.
* @param $group
* The group this message belongs to.
* @return
* TRUE on pass, FALSE on fail.
*/
protected function assertFieldByName($name, $value = NULL, $message = NULL) {
Proposed resolution
1. Comment all uses of group in TestBase.php and WebTestBase.php:
* @param $group
* (optional) The group this message belongs to, defaults to 'Other'.
2. Make sure the $group parameter is defined and used, where appropriate.
3. Document when and where the group designation should be used. (This started at #1742830: Removing t() from asserts in simpletests in contact module where the group designation is being removed for consistency.)
4. As it's so closely related, fix the doxygen comments for $message at the same time.
Remaining tasks
Prepare a patch to remove the inconsistencies.
Context issue #500866: [META] remove t() from assert message
Comments
Comment #1
Lars Toomre CreditAttribution: Lars Toomre commentedIf we get to the point of removing unnecessary group parameters (because they match the default group parameter), I would suggest looking at the tests in File, Lock and User groups.
Comment #2
lazysoundsystem CreditAttribution: lazysoundsystem commentedOkay, I thought I'd looked at this before but couldn't find the issue.
There's a patch supplied here for the issues in WebTestBase.php:
#983528: support $group and $message parameters in all assert() functions
but still it's worth documenting the best way to use the $group parameter in tests. (In that issue, the suggestion is that modules should use it, so it's easier to find out where the tests failed.)
(And as a related, but more important issue - can someone have a look at: #1706878: Add WebTestBase::assertThemeOutput() to allow modules to test theme function output)
Comment #3
lazysoundsystem CreditAttribution: lazysoundsystem commentedThis has been fixed in #1817144: Some test assertions are inconsistent with the others.
Comment #3.0
lazysoundsystem CreditAttribution: lazysoundsystem commentedUpdated issue summary.