Permalink
Browse files

Merge pull request #1962 from squaresurf/d2ae1d1d7fdc4b8a21369a25487c…

…2c42e5a496bf

Refactored Unit_test in order to remove redundant code.
  • Loading branch information...
2 parents 751f247 + d2ae1d1 commit b1b1528183d46c001afa08352ad35b2ec341ebc5 @narfbg narfbg committed Nov 4, 2012
Showing with 6 additions and 25 deletions.
  1. +6 −25 system/libraries/Unit_test.php
View
31 system/libraries/Unit_test.php
@@ -158,7 +158,7 @@ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes =
$back = $this->_backtrace();
- $report[] = array (
+ $report = array (
'test_name' => $test_name,
'test_datatype' => gettype($test),
'res_datatype' => $extype,
@@ -170,7 +170,7 @@ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes =
$this->results[] = $report;
- return $this->report($this->result($report));
+ return $this->report($this->result(array($report)));
}
// --------------------------------------------------------------------
@@ -284,30 +284,11 @@ public function result($results = array())
continue;
}
- if (is_array($val))
+ if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
{
- foreach ($val as $k => $v)
- {
- if ( ! in_array($k, $this->_test_items_visible))
- {
- continue;
- }
-
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v))))
- {
- $v = $line;
- }
- $temp[$CI->lang->line('ut_'.$k)] = $v;
- }
- }
- else
- {
- if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
- {
- $val = $line;
- }
- $temp[$CI->lang->line('ut_'.$key)] = $val;
+ $val = $line;
}
+ $temp[$CI->lang->line('ut_'.$key)] = $val;
}
$retval[] = $temp;
@@ -415,4 +396,4 @@ function is_false($test)
}
/* End of file Unit_test.php */
-/* Location: ./system/libraries/Unit_test.php */
+/* Location: ./system/libraries/Unit_test.php */

0 comments on commit b1b1528

Please sign in to comment.