diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/core/Benchmark_test.php | 2 | ||||
-rw-r--r-- | tests/codeigniter/core/Input_test.php | 12 | ||||
-rw-r--r-- | tests/codeigniter/core/Security_test.php | 2 | ||||
-rw-r--r-- | tests/mocks/core/common.php | 11 | ||||
-rw-r--r-- | tests/mocks/core/uri.php | 5 |
5 files changed, 23 insertions, 9 deletions
diff --git a/tests/codeigniter/core/Benchmark_test.php b/tests/codeigniter/core/Benchmark_test.php index a239ba51d..aff736a40 100644 --- a/tests/codeigniter/core/Benchmark_test.php +++ b/tests/codeigniter/core/Benchmark_test.php @@ -30,7 +30,7 @@ class Benchmark_test extends CI_TestCase { sleep(1); $this->benchmark->mark('code_end'); - $this->assertEquals('1.0', $this->benchmark->elapsed_time('code_start', 'code_end', 1)); + $this->assertEquals('1', $this->benchmark->elapsed_time('code_start', 'code_end', 0)); } // -------------------------------------------------------------------- diff --git a/tests/codeigniter/core/Input_test.php b/tests/codeigniter/core/Input_test.php index 5cf25fefa..0a98e556c 100644 --- a/tests/codeigniter/core/Input_test.php +++ b/tests/codeigniter/core/Input_test.php @@ -82,11 +82,21 @@ class Input_test extends CI_TestCase { // -------------------------------------------------------------------- - public function test_get_post() + public function test_post_get() { $_SERVER['REQUEST_METHOD'] = 'POST'; $_POST['foo'] = 'bar'; + $this->assertEquals('bar', $this->input->post_get('foo')); + } + + // -------------------------------------------------------------------- + + public function test_get_post() + { + $_SERVER['REQUEST_METHOD'] = 'GET'; + $_GET['foo'] = 'bar'; + $this->assertEquals('bar', $this->input->get_post('foo')); } diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php index 3f6e3b07a..433ad313f 100644 --- a/tests/codeigniter/core/Security_test.php +++ b/tests/codeigniter/core/Security_test.php @@ -5,7 +5,7 @@ class Security_test extends CI_TestCase { public function set_up() { // Set cookie for security test - $_COOKIE['ci_csrf_cookie'] = md5(uniqid(rand(), TRUE)); + $_COOKIE['ci_csrf_cookie'] = md5(uniqid(mt_rand(), TRUE)); // Set config for Security class $this->ci_set_config('csrf_protection', TRUE); diff --git a/tests/mocks/core/common.php b/tests/mocks/core/common.php index 0ccfe1ea4..b073f230d 100644 --- a/tests/mocks/core/common.php +++ b/tests/mocks/core/common.php @@ -178,7 +178,7 @@ if ( ! function_exists('is_loaded')) if ( ! function_exists('log_message')) { - function log_message($level, $message, $php_error = FALSE) + function log_message($level, $message) { return TRUE; } @@ -190,4 +190,13 @@ if ( ! function_exists('set_status_header')) { return TRUE; } +} + +if ( ! function_exists('is_cli')) +{ + // In order to test HTTP functionality, we need to lie about this + function is_cli() + { + return FALSE; + } }
\ No newline at end of file diff --git a/tests/mocks/core/uri.php b/tests/mocks/core/uri.php index 94f75df64..11078587b 100644 --- a/tests/mocks/core/uri.php +++ b/tests/mocks/core/uri.php @@ -18,9 +18,4 @@ class Mock_Core_URI extends CI_URI { } - protected function _is_cli_request() - { - return FALSE; - } - }
\ No newline at end of file |