From dd6719738936be31cdaa1758ca86d5eb14dcab3d Mon Sep 17 00:00:00 2001 From: Barry Mieny Date: Mon, 4 Oct 2010 16:33:58 +0200 Subject: Cleanup of stray spaces and tabs --- system/libraries/Unit_test.php | 110 ++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index c47143637..9a90cb47c 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -29,9 +29,9 @@ class CI_Unit_test { var $active = TRUE; - var $results = array(); + var $results = array(); var $strict = FALSE; - var $_template = NULL; + var $_template = NULL; var $_template_rows = NULL; var $_test_items_visible = array(); @@ -82,32 +82,32 @@ class CI_Unit_test { * @param mixed * @param string * @return string - */ + */ function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '') { if ($this->active == FALSE) { return FALSE; } - + if (in_array($expected, array('is_object', 'is_string', 'is_bool', 'is_true', 'is_false', 'is_int', 'is_numeric', 'is_float', 'is_double', 'is_array', 'is_null'), TRUE)) { $expected = str_replace('is_float', 'is_double', $expected); - $result = ($expected($test)) ? TRUE : FALSE; + $result = ($expected($test)) ? TRUE : FALSE; $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected)); } else { if ($this->strict == TRUE) - $result = ($test === $expected) ? TRUE : FALSE; + $result = ($test === $expected) ? TRUE : FALSE; else - $result = ($test == $expected) ? TRUE : FALSE; - + $result = ($test == $expected) ? TRUE : FALSE; + $extype = gettype($expected); } - + $back = $this->_backtrace(); - + $report[] = array ( 'test_name' => $test_name, 'test_datatype' => gettype($test), @@ -124,7 +124,7 @@ class CI_Unit_test { } // -------------------------------------------------------------------- - + /** * Generate a report * @@ -175,9 +175,9 @@ class CI_Unit_test { return $r; } - + // -------------------------------------------------------------------- - + /** * Use strict comparison * @@ -191,9 +191,9 @@ class CI_Unit_test { { $this->strict = ($state == FALSE) ? FALSE : TRUE; } - + // -------------------------------------------------------------------- - + /** * Make Unit testing active * @@ -207,9 +207,9 @@ class CI_Unit_test { { $this->active = ($state == FALSE) ? FALSE : TRUE; } - + // -------------------------------------------------------------------- - + /** * Result Array * @@ -219,15 +219,15 @@ class CI_Unit_test { * @return array */ function result($results = array()) - { + { $CI =& get_instance(); $CI->load->language('unit_test'); - + if (count($results) == 0) { $results = $this->results; } - + $retval = array(); foreach ($results as $result) { @@ -246,8 +246,8 @@ class CI_Unit_test { if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v)))) { $v = $line; - } - $temp[$CI->lang->line('ut_'.$k)] = $v; + } + $temp[$CI->lang->line('ut_'.$k)] = $v; } } else @@ -255,19 +255,19 @@ class CI_Unit_test { if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val)))) { $val = $line; - } + } $temp[$CI->lang->line('ut_'.$key)] = $val; } } - + $retval[] = $temp; } - + return $retval; } - + // -------------------------------------------------------------------- - + /** * Set the template * @@ -276,14 +276,14 @@ class CI_Unit_test { * @access public * @param string * @return void - */ + */ function set_template($template) { $this->_template = $template; } - + // -------------------------------------------------------------------- - + /** * Generate a backtrace * @@ -297,17 +297,17 @@ class CI_Unit_test { if (function_exists('debug_backtrace')) { $back = debug_backtrace(); - + $file = ( ! isset($back['1']['file'])) ? '' : $back['1']['file']; $line = ( ! isset($back['1']['line'])) ? '' : $back['1']['line']; - + return array('file' => $file, 'line' => $line); } return array('file' => 'Unknown', 'line' => 'Unknown'); } // -------------------------------------------------------------------- - + /** * Get Default Template * @@ -315,17 +315,17 @@ class CI_Unit_test { * @return string */ function _default_template() - { + { $this->_template = "\n".''; $this->_template .= '{rows}'; $this->_template .= "\n".'
'; - + $this->_template_rows = "\n\t".''; $this->_template_rows .= "\n\t\t".'{item}'; $this->_template_rows .= "\n\t\t".'{result}'; - $this->_template_rows .= "\n\t".''; + $this->_template_rows .= "\n\t".''; } - + // -------------------------------------------------------------------- /** @@ -336,29 +336,29 @@ class CI_Unit_test { * @access private * @return void */ - function _parse_template() - { - if ( ! is_null($this->_template_rows)) - { - return; - } - - if (is_null($this->_template)) - { - $this->_default_template(); - return; - } - + function _parse_template() + { + if ( ! is_null($this->_template_rows)) + { + return; + } + + if (is_null($this->_template)) + { + $this->_default_template(); + return; + } + if ( ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) { - $this->_default_template(); - return; + $this->_default_template(); + return; } $this->_template_rows = $match['1']; - $this->_template = str_replace($match['0'], '{rows}', $this->_template); - } - + $this->_template = str_replace($match['0'], '{rows}', $this->_template); + } + } // END Unit_test Class -- cgit v1.2.3-24-g4f1b