diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-27 10:54:40 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-27 10:54:40 +0200 |
commit | ce747c8a1e72a30f5369de7d56ba91b72f0e2eb3 (patch) | |
tree | 32433143610df1683131dba5cf4437ddadc306c6 /system/libraries/Unit_test.php | |
parent | 870ad190f068ec16aad45622528ba6747c61c120 (diff) | |
parent | 61318a2c53c13a314f483fcbbfd64c6e01f5242c (diff) |
Merge upstream branch
Diffstat (limited to 'system/libraries/Unit_test.php')
-rw-r--r-- | system/libraries/Unit_test.php | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 2eb8df356..0f6e2dfdd 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * Unit Testing Class * @@ -60,7 +58,7 @@ class CI_Unit_test { 'notes' ); - log_message('debug', "Unit Testing Class Initialized"); + log_message('debug', 'Unit Testing Class Initialized'); } // -------------------------------------------------------------------- @@ -75,7 +73,7 @@ class CI_Unit_test { */ public function set_test_items($items = array()) { - if ( ! empty($items) AND is_array($items)) + if ( ! empty($items) && is_array($items)) { $this->_test_items_visible = $items; } @@ -102,8 +100,8 @@ class CI_Unit_test { 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; + $expected = str_replace('is_double', 'is_float', $expected); + $result = $expected($test); $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected)); } else @@ -186,7 +184,7 @@ class CI_Unit_test { * Causes the evaluation to use === rather than == * * @param bool - * @return null + * @return void */ public function use_strict($state = TRUE) { @@ -201,7 +199,7 @@ class CI_Unit_test { * Enables/disables unit testing * * @param bool - * @return null + * @return void */ public function active($state = TRUE) { @@ -311,10 +309,10 @@ class CI_Unit_test { */ protected function _default_template() { - $this->_template = "\n".'<table style="width:100%; font-size:small; margin:10px 0; border-collapse:collapse; border:1px solid #CCC;">{rows}'."\n".'</table>'; + $this->_template = "\n".'<table style="width:100%; font-size:small; margin:10px 0; border-collapse:collapse; border:1px solid #CCC;">{rows}'."\n</table>"; $this->_template_rows = "\n\t<tr>\n\t\t".'<th style="text-align: left; border-bottom:1px solid #CCC;">{item}</th>' - . "\n\t\t".'<td style="border-bottom:1px solid #CCC;">{result}</td>'."\n\t</tr>"; + ."\n\t\t".'<td style="border-bottom:1px solid #CCC;">{result}</td>'."\n\t</tr>"; } // -------------------------------------------------------------------- @@ -333,7 +331,7 @@ class CI_Unit_test { return; } - if (is_null($this->_template) OR ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) + if (is_null($this->_template) OR ! preg_match('/\{rows\}(.*?)\{\/rows\}/si', $this->_template, $match)) { $this->_default_template(); return; @@ -344,7 +342,6 @@ class CI_Unit_test { } } -// END Unit_test Class /** * Helper functions to test boolean true/false @@ -353,13 +350,12 @@ class CI_Unit_test { */ function is_true($test) { - return (is_bool($test) AND $test === TRUE) ? TRUE : FALSE; + return (is_bool($test) && $test === TRUE); } function is_false($test) { - return (is_bool($test) AND $test === FALSE) ? TRUE : FALSE; + return (is_bool($test) && $test === FALSE); } - /* End of file Unit_test.php */ -/* Location: ./system/libraries/Unit_test.php */ +/* Location: ./system/libraries/Unit_test.php */
\ No newline at end of file |