Skip to content
Browse files

_suppressEolIssues becomes _normalizeLineEndings and returns array

  • Loading branch information...
1 parent de9949e commit b338b7fcdba5ef60549528b541136ffbbf6c9ad6 @hans-d hans-d committed May 24, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 test/Unit.php
View
18 test/Unit.php
@@ -248,12 +248,12 @@ public function fail($message = false) {
* in assertEqual, assertNotEqual, assertPattern and assertNotPattern this function is
* called to get rid of any EOL differences.
*/
- protected function _suppressEolIssues(&$expected, &$result) {
- if (!is_string($expected) && !is_string($result)) {
- continue;
+ protected function _normalizeLineEndings($expected, $result) {
+ if (is_string($expected) && is_string($result)) {
+ $expected = preg_replace('/\r\n/', "\n", $expected);
+ $result = preg_replace('/\r\n/', "\n", $result);
}
- $expected = preg_replace('/\r\n/', "\n", $expected);
- $result = preg_replace('/\r\n/', "\n", $result);
+ return array($expected, $result);
}
/**
@@ -265,7 +265,7 @@ protected function _suppressEolIssues(&$expected, &$result) {
* @param string|boolean $message
*/
public function assertEqual($expected, $result, $message = false) {
- $this->_suppressEolIssues($expected, $result);
+ list($expected, $result) = $this->_normalizeLineEndings($expected, $result);
$data = ($expected != $result) ? $this->_compare('equal', $expected, $result) : null;
$this->assert($expected == $result, $message, $data);
}
@@ -278,7 +278,7 @@ public function assertEqual($expected, $result, $message = false) {
* @param string|boolean $message
*/
public function assertNotEqual($expected, $result, $message = false) {
- $this->_suppressEolIssues($expected, $result);
+ list($expected, $result) = $this->_normalizeLineEndings($expected, $result);
$this->assert($result != $expected, $message, compact('expected', 'result'));
}
@@ -361,7 +361,7 @@ public function assertNull($result, $message = '{:message}') {
* @param string $message
*/
public function assertNoPattern($expected, $result, $message = '{:message}') {
- $this->_suppressEolIssues($expected, $result);
+ list($expected, $result) = $this->_normalizeLineEndings($expected, $result);
$this->assert(!preg_match($expected, $result), $message, compact('expected', 'result'));
}
@@ -373,7 +373,7 @@ public function assertNoPattern($expected, $result, $message = '{:message}') {
* @param string $message
*/
public function assertPattern($expected, $result, $message = '{:message}') {
- $this->_suppressEolIssues($expected, $result);
+ list($expected, $result) = $this->_normalizeLineEndings($expected, $result);
$this->assert(!!preg_match($expected, $result), $message, compact('expected', 'result'));
}

0 comments on commit b338b7f

Please sign in to comment.
Something went wrong with that request. Please try again.