Skip to content
Snippets Groups Projects
Commit fb9d4564 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #299461 by Damien Tournoud: fixed annoying glitches with assertEqual().

parent 6261c4ca
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,7 @@ protected function _assert($status, $message = '', $group = 'Other', $custom_cal
* The status passed in.
*/
protected function assertTrue($value, $message = '', $group = 'Other') {
return $this->_assert((bool) $value, $message ? $message : t('%value is TRUE', array('%value' => $value)), $group);
return $this->_assert((bool) $value, $message ? $message : t('Value is TRUE'), $group);
}
/**
......@@ -121,7 +121,7 @@ protected function assertTrue($value, $message = '', $group = 'Other') {
* The status passed in.
*/
protected function assertFalse($value, $message = '', $group = 'Other') {
return $this->_assert(!$value, $message ? $message : t('%value is FALSE', array('%value' => $value)), $group);
return $this->_assert(!$value, $message ? $message : t('Value is FALSE'), $group);
}
/**
......@@ -137,7 +137,7 @@ protected function assertFalse($value, $message = '', $group = 'Other') {
* The status passed in.
*/
protected function assertNull($value, $message = '', $group = 'Other') {
return $this->_assert(!isset($value), $message ? $message : t('%value is NULL', array('%value' => $value)), $group);
return $this->_assert(!isset($value), $message ? $message : t('Value is NULL'), $group);
}
/**
......@@ -153,7 +153,7 @@ protected function assertNull($value, $message = '', $group = 'Other') {
* The status passed in.
*/
protected function assertNotNull($value, $message = '', $group = 'Other') {
return $this->_assert(isset($value), $message ? $message : t('%value is not NULL', array('%value' => $value)), $group);
return $this->_assert(isset($value), $message ? $message : t('Value is not NULL'), $group);
}
/**
......@@ -171,7 +171,7 @@ protected function assertNotNull($value, $message = '', $group = 'Other') {
* The status passed in.
*/
protected function assertEqual($first, $second, $message = '', $group = 'Other') {
return $this->_assert($first == $second, $message ? $message : t('%first is equal to %second', array('%first' => $first, '%second' => $second)), $group);
return $this->_assert($first == $second, $message ? $message : t('First value is equal to second value'), $group);
}
/**
......@@ -189,7 +189,7 @@ protected function assertEqual($first, $second, $message = '', $group = 'Other')
* The status passed in.
*/
protected function assertNotEqual($first, $second, $message = '', $group = 'Other') {
return $this->_assert($first != $second, $message ? $message : t('%first is not equal to %second', array('%first' => $first, '%second' => $second)), $group);
return $this->_assert($first != $second, $message ? $message : t('First value is not equal to second value'), $group);
}
/**
......@@ -207,7 +207,7 @@ protected function assertNotEqual($first, $second, $message = '', $group = 'Othe
* The status passed in.
*/
protected function assertIdentical($first, $second, $message = '', $group = 'Other') {
return $this->_assert($first === $second, $message ? $message : t('%first is identical to %second', array('%first' => $first, '%second' => $second)), $group);
return $this->_assert($first === $second, $message ? $message : t('First value is identical to second value'), $group);
}
/**
......@@ -225,7 +225,7 @@ protected function assertIdentical($first, $second, $message = '', $group = 'Oth
* The status passed in.
*/
protected function assertNotIdentical($first, $second, $message = '', $group = 'Other') {
return $this->_assert($first !== $second, $message ? $message : t('%first is not identical to %second', array('%first' => $first, '%second' => $second)), $group);
return $this->_assert($first !== $second, $message ? $message : t('First value is not identical to second value'), $group);
}
/**
......@@ -1254,7 +1254,7 @@ function drupalSetContent($content, $url = 'internal:') {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertRaw($raw, $message = "%s", $group = 'Other') {
function assertRaw($raw, $message = '%s found', $group = 'Other') {
return $this->_assert(strpos($this->_content, $raw) !== FALSE, $message, $group);
}
......@@ -1271,7 +1271,7 @@ function assertRaw($raw, $message = "%s", $group = 'Other') {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertNoRaw($raw, $message = "%s", $group = 'Other') {
function assertNoRaw($raw, $message = '%s found', $group = 'Other') {
return $this->_assert(strpos($this->_content, $raw) === FALSE, $message, $group);
}
......@@ -1332,7 +1332,7 @@ protected function assertTextHelper($text, $message, $group, $not_exists) {
$this->plain_text = filter_xss($this->_content, array());
}
if (!$message) {
$message = '"' . $text . '"' . ($not_exists ? ' not found.' : ' found.');
$message = '"' . $text . '"' . ($not_exists ? ' not found' : ' found');
}
return $this->_assert($not_exists == (strpos($this->plain_text, $text) === FALSE), $message, $group);
}
......@@ -1349,7 +1349,7 @@ protected function assertTextHelper($text, $message, $group, $not_exists) {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertPattern($pattern, $message = '%s', $group = 'Other') {
function assertPattern($pattern, $message = 'Pattern %s found', $group = 'Other') {
return $this->_assert((bool) preg_match($pattern, $this->drupalGetContent()), $message, $group);
}
......@@ -1365,7 +1365,7 @@ function assertPattern($pattern, $message = '%s', $group = 'Other') {
* @return
* TRUE on pass, FALSE on fail.
*/
function assertNoPattern($pattern, $message = '%s', $group = 'Other') {
function assertNoPattern($pattern, $message = 'Pattern %s not found', $group = 'Other') {
return $this->_assert(!preg_match($pattern, $this->drupalGetContent()), $message, $group);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment