From 33c9c3f80149825e2ffb9e67675747262b563afc Mon Sep 17 00:00:00 2001 From: Gerry Date: Sun, 25 Sep 2011 00:32:38 +0800 Subject: Fixing the documentation link in the Unit_test library so that it points to the correct page --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 5bd7e801a..d9bc8ef6b 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -24,7 +24,7 @@ * @subpackage Libraries * @category UnitTesting * @author ExpressionEngine Dev Team - * @link http://codeigniter.com/user_guide/libraries/uri.html + * @link http://codeigniter.com/user_guide/libraries/unit_testing.html */ class CI_Unit_test { @@ -380,4 +380,4 @@ function is_false($test) /* End of file Unit_test.php */ -/* Location: ./system/libraries/Unit_test.php */ \ No newline at end of file +/* Location: ./system/libraries/Unit_test.php */ -- cgit v1.2.3-24-g4f1b From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/libraries/Unit_test.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index d9bc8ef6b..7afe40b09 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.3.1 * @filesource @@ -23,7 +35,7 @@ * @package CodeIgniter * @subpackage Libraries * @category UnitTesting - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/libraries/unit_testing.html */ class CI_Unit_test { -- cgit v1.2.3-24-g4f1b From 2a27d312074598346e29bfe76bb87b81a00554d4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 25 Dec 2011 17:08:24 +0200 Subject: Improve the Unit test library --- system/libraries/Unit_test.php | 90 +++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 54 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 7afe40b09..dac1a5c7e 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -1,13 +1,13 @@ -active == FALSE) { @@ -110,11 +110,7 @@ class CI_Unit_test { } else { - if ($this->strict == TRUE) - $result = ($test === $expected) ? TRUE : FALSE; - else - $result = ($test == $expected) ? TRUE : FALSE; - + $result = ($this->strict == TRUE) ? ($test === $expected) : ($test == $expected); $extype = gettype($expected); } @@ -145,9 +141,9 @@ class CI_Unit_test { * @access public * @return string */ - function report($result = array()) + public function report($result = array()) { - if (count($result) == 0) + if (count($result) === 0) { $result = $this->result(); } @@ -176,10 +172,7 @@ class CI_Unit_test { } } - $temp = $this->_template_rows; - $temp = str_replace('{item}', $key, $temp); - $temp = str_replace('{result}', $val, $temp); - $table .= $temp; + $table .= str_replace(array('{item}', '{result}'), array($key, $val), $this->_template_rows); } $r .= str_replace('{rows}', $table, $this->_template); @@ -199,9 +192,9 @@ class CI_Unit_test { * @param bool * @return null */ - function use_strict($state = TRUE) + public function use_strict($state = TRUE) { - $this->strict = ($state == FALSE) ? FALSE : TRUE; + $this->strict = (bool) $state; } // -------------------------------------------------------------------- @@ -215,9 +208,9 @@ class CI_Unit_test { * @param bool * @return null */ - function active($state = TRUE) + public function active($state = TRUE) { - $this->active = ($state == FALSE) ? FALSE : TRUE; + $this->active = (bool) $state; } // -------------------------------------------------------------------- @@ -230,12 +223,12 @@ class CI_Unit_test { * @access public * @return array */ - function result($results = array()) + public function result($results = array()) { $CI =& get_instance(); $CI->load->language('unit_test'); - if (count($results) == 0) + if (count($results) === 0) { $results = $this->results; } @@ -289,7 +282,7 @@ class CI_Unit_test { * @param string * @return void */ - function set_template($template) + public function set_template($template) { $this->_template = $template; } @@ -304,16 +297,15 @@ class CI_Unit_test { * @access private * @return array */ - function _backtrace() + private function _backtrace() { 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' => (isset($back[1]['file']) ? $back[1]['file'] : ''), + 'line' => (isset($back[1]['line']) ? $back[1]['line'] : '') + ); } return array('file' => 'Unknown', 'line' => 'Unknown'); } @@ -326,16 +318,12 @@ class CI_Unit_test { * @access private * @return string */ - function _default_template() + private 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 = "\n".'{rows}'."\n".'
'; + + $this->_template_rows = "\n\t\n\t\t".'{item}' + . "\n\t\t".'{result}'."\n\t"; } // -------------------------------------------------------------------- @@ -348,27 +336,21 @@ class CI_Unit_test { * @access private * @return void */ - function _parse_template() + private 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)) + if (is_null($this->_template) OR ! preg_match("/\{rows\}(.*?)\{\/rows\}/si", $this->_template, $match)) { $this->_default_template(); return; } - $this->_template_rows = $match['1']; - $this->_template = str_replace($match['0'], '{rows}', $this->_template); + $this->_template_rows = $match[1]; + $this->_template = str_replace($match[0], '{rows}', $this->_template); } } -- cgit v1.2.3-24-g4f1b From 114586fa466e085180f8c2c5b9ec1c514b3cefb2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Dec 2011 16:27:17 +0200 Subject: Replace private with protected, so the class can be easily extended --- system/libraries/Unit_test.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index dac1a5c7e..99c34ea61 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -43,9 +43,9 @@ class CI_Unit_test { public $active = TRUE; public $results = array(); public $strict = FALSE; - private $_template = NULL; - private $_template_rows = NULL; - private $_test_items_visible = array(); + protected $_template = NULL; + protected $_template_rows = NULL; + protected $_test_items_visible = array(); public function __construct() { @@ -294,10 +294,10 @@ class CI_Unit_test { * * This lets us show file names and line numbers * - * @access private + * @access protected * @return array */ - private function _backtrace() + protected function _backtrace() { if (function_exists('debug_backtrace')) { @@ -315,10 +315,10 @@ class CI_Unit_test { /** * Get Default Template * - * @access private + * @access protected * @return string */ - private function _default_template() + protected function _default_template() { $this->_template = "\n".'{rows}'."\n".'
'; @@ -333,10 +333,10 @@ class CI_Unit_test { * * Harvests the data within the template {pseudo-variables} * - * @access private + * @access protected * @return void */ - private function _parse_template() + protected function _parse_template() { if ( ! is_null($this->_template_rows)) { @@ -360,7 +360,7 @@ class CI_Unit_test { * Helper functions to test boolean true/false * * - * @access private + * @access protected * @return bool */ function is_true($test) -- cgit v1.2.3-24-g4f1b From 9c0e2346e06e71d4f2c467f986dc39ff30137643 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 27 Dec 2011 02:42:31 +0200 Subject: Remove access lines from method descriptions --- system/libraries/Unit_test.php | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 99c34ea61..fd3880d29 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -70,7 +70,6 @@ class CI_Unit_test { * * Runs the supplied tests * - * @access public * @param array * @return void */ @@ -89,7 +88,6 @@ class CI_Unit_test { * * Runs the supplied tests * - * @access public * @param mixed * @param mixed * @param string @@ -138,7 +136,6 @@ class CI_Unit_test { * * Displays a table with the test data * - * @access public * @return string */ public function report($result = array()) @@ -188,7 +185,6 @@ class CI_Unit_test { * * Causes the evaluation to use === rather than == * - * @access public * @param bool * @return null */ @@ -204,7 +200,6 @@ class CI_Unit_test { * * Enables/disables unit testing * - * @access public * @param bool * @return null */ @@ -220,7 +215,6 @@ class CI_Unit_test { * * Returns the raw result data * - * @access public * @return array */ public function result($results = array()) @@ -278,7 +272,6 @@ class CI_Unit_test { * * This lets us set the template to be used to display results * - * @access public * @param string * @return void */ @@ -294,7 +287,6 @@ class CI_Unit_test { * * This lets us show file names and line numbers * - * @access protected * @return array */ protected function _backtrace() @@ -315,7 +307,6 @@ class CI_Unit_test { /** * Get Default Template * - * @access protected * @return string */ protected function _default_template() @@ -333,7 +324,6 @@ class CI_Unit_test { * * Harvests the data within the template {pseudo-variables} * - * @access protected * @return void */ protected function _parse_template() @@ -359,8 +349,6 @@ class CI_Unit_test { /** * Helper functions to test boolean true/false * - * - * @access protected * @return bool */ function is_true($test) -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index fd3880d29..38d767c69 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 38d767c69..2eb8df356 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 1b815532378bd444347d1bc741771e13108147b6 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 3 Apr 2012 16:06:03 +0300 Subject: Minor cleanup and style fixes in the Unit_test and Image_lib libraries --- system/libraries/Unit_test.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'system/libraries/Unit_test.php') 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".'{rows}'."\n".'
'; + $this->_template = "\n".'{rows}'."\n
"; $this->_template_rows = "\n\t\n\t\t".'{item}' - . "\n\t\t".'{result}'."\n\t"; + ."\n\t\t".'{result}'."\n\t"; } // -------------------------------------------------------------------- @@ -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 -- cgit v1.2.3-24-g4f1b From 5645479c622eb36cf9869797896dc0921568c4a9 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:32:19 +0300 Subject: Clean up the libraries --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 0f6e2dfdd..6ec2dcd5d 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -350,11 +350,11 @@ class CI_Unit_test { */ function is_true($test) { - return (is_bool($test) && $test === TRUE); + return ($test === TRUE); } function is_false($test) { - return (is_bool($test) && $test === FALSE); + return ($test === FALSE); } /* End of file Unit_test.php */ -- cgit v1.2.3-24-g4f1b From d261b1e89c3d4d5191036d5a5660ef6764e593a0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:12:16 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/libraries --- system/libraries/Unit_test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6ec2dcd5d..a87cf7e14 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -93,7 +93,7 @@ class CI_Unit_test { */ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '') { - if ($this->active == FALSE) + if ($this->active === FALSE) { return FALSE; } @@ -106,7 +106,7 @@ class CI_Unit_test { } else { - $result = ($this->strict == TRUE) ? ($test === $expected) : ($test == $expected); + $result = ($this->strict === TRUE) ? ($test === $expected) : ($test === $expected); $extype = gettype($expected); } @@ -155,13 +155,13 @@ class CI_Unit_test { foreach ($res as $key => $val) { - if ($key == $CI->lang->line('ut_result')) + if ($key === $CI->lang->line('ut_result')) { - if ($val == $CI->lang->line('ut_passed')) + if ($val === $CI->lang->line('ut_passed')) { $val = ''.$val.''; } - elseif ($val == $CI->lang->line('ut_failed')) + elseif ($val === $CI->lang->line('ut_failed')) { $val = ''.$val.''; } -- cgit v1.2.3-24-g4f1b From c839d28f4230dce0c658338f267b821cc16490a2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 7 Jun 2012 14:35:27 +0300 Subject: Remove some unnecessary function_exists() checks and some minor improvements --- system/libraries/Unit_test.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index a87cf7e14..70ad8dc41 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -124,7 +124,7 @@ class CI_Unit_test { $this->results[] = $report; - return($this->report($this->result($report))); + return $this->report($this->result($report)); } // -------------------------------------------------------------------- @@ -289,15 +289,11 @@ class CI_Unit_test { */ protected function _backtrace() { - if (function_exists('debug_backtrace')) - { - $back = debug_backtrace(); - return array( - 'file' => (isset($back[1]['file']) ? $back[1]['file'] : ''), - 'line' => (isset($back[1]['line']) ? $back[1]['line'] : '') - ); - } - return array('file' => 'Unknown', 'line' => 'Unknown'); + $back = debug_backtrace(); + return array( + 'file' => (isset($back[1]['file']) ? $back[1]['file'] : ''), + 'line' => (isset($back[1]['line']) ? $back[1]['line'] : '') + ); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From c4a3c3cb01dcc5fbcd079313a8576c701f3f54ff Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Wed, 3 Oct 2012 14:34:37 -0700 Subject: Updated result function to check for visible items as defined in issue #395 --- system/libraries/Unit_test.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 70ad8dc41..435c32693 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -240,6 +240,11 @@ class CI_Unit_test { { 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; -- cgit v1.2.3-24-g4f1b From 9438e26671ee1f0b49c8da7a56a0a195788fd5da Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 5 Oct 2012 13:16:27 +0300 Subject: Fix issue #116 + other space/style fixes [ci skip --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 435c32693..c2c01758e 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -244,7 +244,7 @@ class CI_Unit_test { { continue; } - + if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$v)))) { $v = $line; -- cgit v1.2.3-24-g4f1b From 5fd3ae8d33a4f5d3159b86683b9a670e973a63f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 24 Oct 2012 14:55:35 +0300 Subject: [ci skip] style and phpdoc-related changes (rel #1295) --- system/libraries/Unit_test.php | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index c2c01758e..7b99dee0d 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -38,13 +38,18 @@ */ class CI_Unit_test { - public $active = TRUE; - public $results = array(); - public $strict = FALSE; - protected $_template = NULL; - protected $_template_rows = NULL; + public $active = TRUE; + public $results = array(); + public $strict = FALSE; + protected $_template = NULL; + protected $_template_rows = NULL; protected $_test_items_visible = array(); + /** + * Constructor + * + * @return void + */ public function __construct() { // These are the default items visible when a test is run. @@ -86,9 +91,10 @@ class CI_Unit_test { * * Runs the supplied tests * - * @param mixed - * @param mixed - * @param string + * @param mixed $test + * @param mixed $expected = TRUE + * @param string $test_name = 'undefined' + * @param string $notes = '' * @return string */ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '') @@ -134,6 +140,7 @@ class CI_Unit_test { * * Displays a table with the test data * + * @param array $result = array() * @return string */ public function report($result = array()) @@ -213,6 +220,7 @@ class CI_Unit_test { * * Returns the raw result data * + * @param array $results = array() * @return array */ public function result($results = array()) @@ -345,14 +353,22 @@ class CI_Unit_test { } /** - * Helper functions to test boolean true/false + * Helper function to test boolean TRUE * + * @param mixed $test * @return bool */ function is_true($test) { return ($test === TRUE); } + +/** + * Helper function to test boolean FALSE + * + * @param mixed $test + * @return bool + */ function is_false($test) { return ($test === FALSE); -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/libraries/Unit_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 7b99dee0d..5c0018d35 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -1,4 +1,4 @@ - Date: Thu, 1 Nov 2012 22:56:26 +0200 Subject: [ci skip] DocBlocks for Email, Ftp, Unit_test and Javascript libraries Partially fixes issue #1295 --- system/libraries/Unit_test.php | 51 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 5c0018d35..2710b5513 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -39,13 +39,52 @@ defined('BASEPATH') OR exit('No direct script access allowed'); */ class CI_Unit_test { + /** + * Active flag + * + * @var bool + */ public $active = TRUE; + + /** + * Test results + * + * @var array + */ public $results = array(); + + /** + * Strict comparison flag + * + * Whether to use === or == when comparing + * + * @var bool + */ public $strict = FALSE; + + /** + * Template + * + * @var string + */ protected $_template = NULL; + + /** + * Template rows + * + * @var string + */ protected $_template_rows = NULL; + + /** + * List of visible test items + * + * @var array + */ protected $_test_items_visible = array(); + // -------------------------------------------------------------------- + /** * Constructor * @@ -93,9 +132,9 @@ class CI_Unit_test { * Runs the supplied tests * * @param mixed $test - * @param mixed $expected = TRUE - * @param string $test_name = 'undefined' - * @param string $notes = '' + * @param mixed $expected + * @param string $test_name + * @param string $notes * @return string */ public function run($test, $expected = TRUE, $test_name = 'undefined', $notes = '') @@ -113,7 +152,7 @@ class CI_Unit_test { } else { - $result = ($this->strict === TRUE) ? ($test === $expected) : ($test === $expected); + $result = ($this->strict === TRUE) ? ($test === $expected) : ($test == $expected); $extype = gettype($expected); } @@ -141,7 +180,7 @@ class CI_Unit_test { * * Displays a table with the test data * - * @param array $result = array() + * @param array $result * @return string */ public function report($result = array()) @@ -221,7 +260,7 @@ class CI_Unit_test { * * Returns the raw result data * - * @param array $results = array() + * @param array $results * @return array */ public function result($results = array()) -- cgit v1.2.3-24-g4f1b From d2ae1d1d7fdc4b8a21369a25487c2c42e5a496bf Mon Sep 17 00:00:00 2001 From: Daniel Paul Searles Date: Fri, 2 Nov 2012 17:39:44 -0700 Subject: Refactored Unit_test in order to remove redundant code. The Unit_test::run method was adding another dimension to the Unit_test::$results array. For example: Array ( [0] => Array ( [0] => Array ( [test_name] => first_test [test_datatype] => integer [res_datatype] => integer [result] => passed [file] => ######################################## [line] => 60 [notes] => Im expecting this test to pass! ) ) [1] => Array ( [0] => Array ( [test_name] => second_test [test_datatype] => integer [res_datatype] => boolean [result] => failed [file] => ####################################### [line] => 65 [notes] => Im expecting this to fail. ) ) ) The above unneeded dimension created a need to loop through an array in the Unit_test::result method if the method was looping through all results. Signed-off-by: Daniel Paul Searles --- system/libraries/Unit_test.php | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 2710b5513..842b4aebd 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -158,7 +158,7 @@ class CI_Unit_test { $back = $this->_backtrace(); - $report[] = array ( + $report = array ( 'test_name' => $test_name, 'test_datatype' => gettype($test), 'res_datatype' => $extype, @@ -170,7 +170,7 @@ class CI_Unit_test { $this->results[] = $report; - return $this->report($this->result($report)); + return $this->report($this->result(array($report))); } // -------------------------------------------------------------------- @@ -284,30 +284,11 @@ class CI_Unit_test { 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 */ \ No newline at end of file +/* Location: ./system/libraries/Unit_test.php */ -- cgit v1.2.3-24-g4f1b From ce0c9561e9068d5dab9c473f1ca0709b0d222cf1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 22 Nov 2012 17:26:29 +0200 Subject: Fix issue #118 (manually implementing PR #1832) --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 842b4aebd..05c7eef78 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -284,11 +284,11 @@ class CI_Unit_test { continue; } - if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val)))) + if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE))) { $val = $line; } - $temp[$CI->lang->line('ut_'.$key)] = $val; + $temp[$CI->lang->line('ut_'.$key, FALSE)] = $val; } $retval[] = $temp; -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 05c7eef78..de8c9bb80 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b From 1228fe27bc1f22838cd80c5fe33c37274faf0e24 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Jan 2013 01:30:09 +0100 Subject: Replace is_null() with === / !== NULL Exact same behavior, but faster. I also think it's more readable. --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index de8c9bb80..7a67c7276 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -356,12 +356,12 @@ class CI_Unit_test { */ protected function _parse_template() { - if ( ! is_null($this->_template_rows)) + if ($this->_template_rows !== NULL) { return; } - if (is_null($this->_template) OR ! preg_match('/\{rows\}(.*?)\{\/rows\}/si', $this->_template, $match)) + if ($this->_template === NULL OR ! preg_match('/\{rows\}(.*?)\{\/rows\}/si', $this->_template, $match)) { $this->_default_template(); return; -- cgit v1.2.3-24-g4f1b From a6eae87d14efe3169156a12ad3706852ff70e2c4 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 3 Jan 2014 18:25:20 +0200 Subject: [ci skip] Some spaces & docblock fixes --- system/libraries/Unit_test.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 7a67c7276..53e4dfac4 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -81,7 +81,15 @@ class CI_Unit_test { * * @var array */ - protected $_test_items_visible = array(); + protected $_test_items_visible = array( + 'test_name', + 'test_datatype', + 'res_datatype', + 'result', + 'file', + 'line', + 'notes' + ); // -------------------------------------------------------------------- @@ -92,17 +100,6 @@ class CI_Unit_test { */ public function __construct() { - // These are the default items visible when a test is run. - $this->_test_items_visible = array ( - 'test_name', - 'test_datatype', - 'res_datatype', - 'result', - 'file', - 'line', - 'notes' - ); - log_message('debug', 'Unit Testing Class Initialized'); } @@ -230,7 +227,7 @@ class CI_Unit_test { * * Causes the evaluation to use === rather than == * - * @param bool + * @param bool $state * @return void */ public function use_strict($state = TRUE) @@ -288,6 +285,7 @@ class CI_Unit_test { { $val = $line; } + $temp[$CI->lang->line('ut_'.$key, FALSE)] = $val; } @@ -396,4 +394,4 @@ function is_false($test) } /* End of file Unit_test.php */ -/* Location: ./system/libraries/Unit_test.php */ +/* Location: ./system/libraries/Unit_test.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From cb663676e63c7a4c792181dabea3fd834514cea2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 3 Jan 2014 18:45:37 +0200 Subject: Make CI_Unit_test::set_test_items()'s parameter mandatory (optional doesn't make sense) --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 53e4dfac4..e412b9858 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -110,10 +110,10 @@ class CI_Unit_test { * * Runs the supplied tests * - * @param array + * @param array $items * @return void */ - public function set_test_items($items = array()) + public function set_test_items($items) { if ( ! empty($items) && is_array($items)) { -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index e412b9858..cc882bc72 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/libraries/Unit_test.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index cc882bc72..9bfdecfc7 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 1.3.1 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 1.3.1 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/libraries/Unit_test.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 9bfdecfc7..6137673c0 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b From 90726b8c769ea75aec34814ddfa91655d488e6c3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 20 Jan 2015 12:39:22 +0200 Subject: [ci skip] Change some log messages' level 'Class Loaded' type of messages flood log files when log_threshold is set to 2 (debug). They're now logged as 'info' level. This is manually applying PR #1528, which was created to do the same thing, but became outdated. --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6137673c0..0b8bcd7c4 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -111,7 +111,7 @@ class CI_Unit_test { */ public function __construct() { - log_message('debug', 'Unit Testing Class Initialized'); + log_message('info', 'Unit Testing Class Initialized'); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/libraries/Unit_test.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 0b8bcd7c4..7b744adc6 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -403,6 +403,3 @@ function is_false($test) { return ($test === FALSE); } - -/* End of file Unit_test.php */ -/* Location: ./system/libraries/Unit_test.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From a5ea5066e4463a3857d6add2c5e2bc6833d1cbc0 Mon Sep 17 00:00:00 2001 From: ftwbzhao Date: Mon, 6 Jul 2015 13:18:11 +0800 Subject: Added "is_resource" into the list of unit tests capable of being run. --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 7b744adc6..60b046ba0 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -152,7 +152,7 @@ class CI_Unit_test { 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)) + 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', 'is_resource'), TRUE)) { $expected = str_replace('is_double', 'is_float', $expected); $result = $expected($test); -- cgit v1.2.3-24-g4f1b From 7018d892512af76043c5843f663da76a7ed08cb7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 8 Jul 2015 17:57:52 +0300 Subject: Fix #3963 --- system/libraries/Unit_test.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 60b046ba0..158f841ed 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -291,10 +291,12 @@ class CI_Unit_test { { continue; } - - if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE))) + elseif (in_array($key, array('test_name', 'test_datatype', 'test_res_datatype', 'result'), TRUE)) { - $val = $line; + if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE))) + { + $val = $line; + } } $temp[$CI->lang->line('ut_'.$key, FALSE)] = $val; -- cgit v1.2.3-24-g4f1b From a45e37e235da97f539548b457ef4ae46d55ce77e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 8 Jul 2015 17:58:21 +0300 Subject: [ci skip] Cleanup some whitespace in CI_Unit_test --- system/libraries/Unit_test.php | 46 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 158f841ed..3f986f3e8 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -55,14 +55,14 @@ class CI_Unit_test { * * @var bool */ - public $active = TRUE; + public $active = TRUE; /** * Test results * * @var array */ - public $results = array(); + public $results = array(); /** * Strict comparison flag @@ -71,21 +71,21 @@ class CI_Unit_test { * * @var bool */ - public $strict = FALSE; + public $strict = FALSE; /** * Template * * @var string */ - protected $_template = NULL; + protected $_template = NULL; /** * Template rows * * @var string */ - protected $_template_rows = NULL; + protected $_template_rows = NULL; /** * List of visible test items @@ -93,13 +93,13 @@ class CI_Unit_test { * @var array */ protected $_test_items_visible = array( - 'test_name', - 'test_datatype', - 'res_datatype', - 'result', - 'file', - 'line', - 'notes' + 'test_name', + 'test_datatype', + 'res_datatype', + 'result', + 'file', + 'line', + 'notes' ); // -------------------------------------------------------------------- @@ -167,14 +167,14 @@ class CI_Unit_test { $back = $this->_backtrace(); $report = array ( - 'test_name' => $test_name, - 'test_datatype' => gettype($test), - 'res_datatype' => $extype, - 'result' => ($result === TRUE) ? 'passed' : 'failed', - 'file' => $back['file'], - 'line' => $back['line'], - 'notes' => $notes - ); + 'test_name' => $test_name, + 'test_datatype' => gettype($test), + 'res_datatype' => $extype, + 'result' => ($result === TRUE) ? 'passed' : 'failed', + 'file' => $back['file'], + 'line' => $back['line'], + 'notes' => $notes + ); $this->results[] = $report; @@ -336,9 +336,9 @@ class CI_Unit_test { { $back = debug_backtrace(); return array( - 'file' => (isset($back[1]['file']) ? $back[1]['file'] : ''), - 'line' => (isset($back[1]['line']) ? $back[1]['line'] : '') - ); + 'file' => (isset($back[1]['file']) ? $back[1]['file'] : ''), + 'line' => (isset($back[1]['line']) ? $back[1]['line'] : '') + ); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 3f986f3e8..2ddc40a1a 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 2ddc40a1a..6db39212b 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 1.3.1 * @filesource */ @@ -46,7 +46,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Libraries * @category UnitTesting * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/libraries/unit_testing.html + * @link https://codeigniter.com/user_guide/libraries/unit_testing.html */ class CI_Unit_test { -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 6db39212b..3ac6af78e 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From b5e2410c54f867307fb88647729794a1ded7e552 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 10 Aug 2016 13:21:15 +0300 Subject: Merge pull request #4754 from tianhe1986/develop_fix_unit_test_name CI_Unit_test: Fix translation of result datatype --- system/libraries/Unit_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 3ac6af78e..ea78e0d98 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -291,7 +291,7 @@ class CI_Unit_test { { continue; } - elseif (in_array($key, array('test_name', 'test_datatype', 'test_res_datatype', 'result'), TRUE)) + elseif (in_array($key, array('test_name', 'test_datatype', 'res_datatype', 'result'), TRUE)) { if (FALSE !== ($line = $CI->lang->line(strtolower('ut_'.$val), FALSE))) { -- cgit v1.2.3-24-g4f1b From 353f7483c61e7e4d375d4637f1e97406669648ac Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 10 Aug 2016 14:18:19 +0300 Subject: Merge pull request #4755 from tianhe1986/develop_not_replace_is_double CI_Unit_test: Do not replace "is_double" with "is_float". --- system/libraries/Unit_test.php | 1 - 1 file changed, 1 deletion(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index ea78e0d98..3122ed624 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -154,7 +154,6 @@ 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', 'is_resource'), TRUE)) { - $expected = str_replace('is_double', 'is_float', $expected); $result = $expected($test); $extype = str_replace(array('true', 'false'), 'bool', str_replace('is_', '', $expected)); } -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/libraries/Unit_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/libraries/Unit_test.php') diff --git a/system/libraries/Unit_test.php b/system/libraries/Unit_test.php index 3122ed624..38e0fbd24 100644 --- a/system/libraries/Unit_test.php +++ b/system/libraries/Unit_test.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.3.1 -- cgit v1.2.3-24-g4f1b