summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Bootstrap.php2
-rw-r--r--tests/codeigniter/core/compat/standard_test.php (renamed from tests/codeigniter/core/compat/array_test.php)44
2 files changed, 39 insertions, 7 deletions
diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php
index cc84abf28..713c0fdb3 100644
--- a/tests/Bootstrap.php
+++ b/tests/Bootstrap.php
@@ -69,7 +69,7 @@ is_php('5.6') && ini_set('php.internal_encoding', 'UTF-8');
include_once SYSTEM_PATH.'core/compat/mbstring.php';
include_once SYSTEM_PATH.'core/compat/hash.php';
include_once SYSTEM_PATH.'core/compat/password.php';
-include_once SYSTEM_PATH.'core/compat/array.php';
+include_once SYSTEM_PATH.'core/compat/standard.php';
include_once $dir.'/mocks/autoloader.php';
spl_autoload_register('autoload');
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