Skip to content

Commit

Permalink
Merge pull request bcit-ci#1962 from squaresurf/d2ae1d1d7fdc4b8a21369…
Browse files Browse the repository at this point in the history
…a25487c2c42e5a496bf

Refactored Unit_test in order to remove redundant code.
  • Loading branch information
narfbg committed Nov 4, 2012
2 parents 751f247 + d2ae1d1 commit b1b1528
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions system/libraries/Unit_test.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes =


$back = $this->_backtrace(); $back = $this->_backtrace();


$report[] = array ( $report = array (
'test_name' => $test_name, 'test_name' => $test_name,
'test_datatype' => gettype($test), 'test_datatype' => gettype($test),
'res_datatype' => $extype, 'res_datatype' => $extype,
Expand All @@ -170,7 +170,7 @@ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes =


$this->results[] = $report; $this->results[] = $report;


return $this->report($this->result($report)); return $this->report($this->result(array($report)));
} }


// -------------------------------------------------------------------- // --------------------------------------------------------------------
Expand Down Expand Up @@ -284,30 +284,11 @@ public function result($results = array())
continue; continue;
} }


if (is_array($val)) if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val))))
{ {
foreach ($val as $k => $v) $val = $line;
{
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;
} }
$temp[$CI->lang->line('ut_'.$key)] = $val;
} }


$retval[] = $temp; $retval[] = $temp;
Expand Down Expand Up @@ -415,4 +396,4 @@ function is_false($test)
} }


/* End of file Unit_test.php */ /* 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.