summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-07-07 09:55:53 +0200
committerAndrey Andreev <narf@devilix.net>2014-07-07 09:55:53 +0200
commit5b3fe7c4af5e08e17480b911fbfa8cf0ef6475c0 (patch)
tree2527178d5f9d28f0dd969b70727a3df8fa0e1717 /tests/codeigniter/core
parentf7bdd80d72dfcc7a0c49cb1c82df88dc1f992b06 (diff)
Fix a few typos and add a backport (compat) for hex2bin()
Diffstat (limited to 'tests/codeigniter/core')
-rw-r--r--tests/codeigniter/core/compat/standard_test.php (renamed from tests/codeigniter/core/compat/array_test.php)44
1 files changed, 38 insertions, 6 deletions
diff --git a/tests/codeigniter/core/compat/array_test.php b/tests/codeigniter/core/compat/standard_test.php
index 9d2deaba6..8c7e7313a 100644
--- a/tests/codeigniter/core/compat/array_test.php
+++ b/tests/codeigniter/core/compat/standard_test.php
@@ -1,6 +1,6 @@
<?php
-class array_test extends CI_TestCase {
+class standard_test extends CI_TestCase {
public function test_bootstrap()
{
@@ -8,13 +8,19 @@ class array_test extends CI_TestCase {
{
return $this->markTestSkipped('All array functions are already available on PHP 5.5');
}
- elseif ( ! is_php('5.3'))
+
+ $this->assertTrue(function_exists('array_column'));
+
+ if ( ! is_php('5.4'))
+ {
+ $this->assertTrue(function_exists('hex2bin'));
+ }
+
+ if ( ! is_php('5.3'))
{
$this->assertTrue(function_exists('array_replace'));
$this->assertTrue(function_exists('array_replace_recursive'));
}
-
- $this->assertTrue(function_exists('array_column'));
}
// ------------------------------------------------------------------------
@@ -334,6 +340,25 @@ class array_test extends CI_TestCase {
// ------------------------------------------------------------------------
/**
+ * hex2bin() tests
+ *
+ * @depends test_bootstrap
+ */
+ public function test_hex2bin()
+ {
+ if (is_php('5.4'))
+ {
+ return $this->markTestSkipped('hex2bin() is already available on PHP 5.4');
+ }
+
+ $this->assertEquals("\x03\x04", hex2bin("0304"));
+ $this->assertEquals('', hex2bin(''));
+ $this->assertEquals("\x01\x02\x03", hex2bin(new FooHex()));
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
* array_replace(), array_replace_recursive() tests
*
* Borrowed from PHP's own tests
@@ -410,8 +435,6 @@ class array_test extends CI_TestCase {
// ------------------------------------------------------------------------
-// These are necessary for the array_column() tests
-
class Foo {
public function __toString()
@@ -426,4 +449,13 @@ class Bar {
{
return 'first_name';
}
+}
+
+class FooHex {
+
+ public function __toString()
+ {
+ return '010203';
+ }
+
} \ No newline at end of file