summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/core
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2021-12-20 14:47:39 +0100
committerAndrey Andreev <narf@devilix.net>2021-12-20 14:51:13 +0100
commit74384ca7f88913b87e982696bb5cb3eb5593c451 (patch)
tree3a17b60268a1869c6ee42468153a34020c2a11ac /tests/codeigniter/core
parentd9218efec1d89e9d633b73f367bcc7b676400621 (diff)
Merge pull request #6074 from philsturgeon/ci3-php8
CodeIgniter 3.0 on PHP 8
Diffstat (limited to 'tests/codeigniter/core')
-rw-r--r--tests/codeigniter/core/Loader_test.php39
-rw-r--r--tests/codeigniter/core/Security_test.php2
-rw-r--r--tests/codeigniter/core/compat/mbstring_test.php4
3 files changed, 28 insertions, 17 deletions
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php
index 8c5bb3021..6a7aa916a 100644
--- a/tests/codeigniter/core/Loader_test.php
+++ b/tests/codeigniter/core/Loader_test.php
@@ -36,7 +36,8 @@ class Loader_test extends CI_TestCase {
// Test loading as an array.
$this->assertInstanceOf('CI_Loader', $this->load->library(array($lib)));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$lib);
// Create library in VFS
$lib = array('unit_test_lib' => 'unit_test_lib');
@@ -87,14 +88,16 @@ class Loader_test extends CI_TestCase {
$this->assertInstanceOf('CI_Loader', $this->load->library($lib));
$this->assertTrue(class_exists($class), $class.' does not exist');
$this->assertTrue(class_exists($ext), $ext.' does not exist');
- $this->assertAttributeInstanceOf($class, $name, $this->ci_obj);
- $this->assertAttributeInstanceOf($ext, $name, $this->ci_obj);
+ $this->assertObjectHasAttribute($name, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$name);
+ $this->assertInstanceOf($ext, $this->ci_obj->$name);
// Test reloading with object name
$obj = 'exttest';
$this->assertInstanceOf('CI_Loader', $this->load->library($lib, NULL, $obj));
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
- $this->assertAttributeInstanceOf($ext, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
+ $this->assertInstanceOf($ext, $this->ci_obj->$obj);
// Test reloading
unset($this->ci_obj->$name);
@@ -137,7 +140,8 @@ class Loader_test extends CI_TestCase {
$obj = 'testy';
$this->assertInstanceOf('CI_Loader', $this->load->library($lib, NULL, $obj));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
$this->assertEquals($cfg, $this->ci_obj->$obj->config);
// Test is_loaded
@@ -168,7 +172,8 @@ class Loader_test extends CI_TestCase {
// Was the model class instantiated.
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$lib);
}
// --------------------------------------------------------------------
@@ -188,12 +193,14 @@ class Loader_test extends CI_TestCase {
// Test loading as an array.
$this->assertInstanceOf('CI_Loader', $this->load->driver(array($driver)));
$this->assertTrue(class_exists($class), $class.' does not exist');
- $this->assertAttributeInstanceOf($class, $driver, $this->ci_obj);
+ $this->assertObjectHasAttribute($driver, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$driver);
// Test loading as a library with a name
$obj = 'testdrive';
$this->assertInstanceOf('CI_Loader', $this->load->library($driver, NULL, $obj));
- $this->assertAttributeInstanceOf($class, $obj, $this->ci_obj);
+ $this->assertObjectHasAttribute($obj, $this->ci_obj);
+ $this->assertInstanceOf($class, $this->ci_obj->$obj);
// Test a string given to params
$this->assertInstanceOf('CI_Loader', $this->load->driver($driver, ' '));
@@ -242,8 +249,9 @@ class Loader_test extends CI_TestCase {
// Was the model class instantiated?
$this->assertTrue(class_exists($model));
$this->assertObjectHasAttribute($name, $this->ci_obj);
- $this->assertAttributeInstanceOf($base, $name, $this->ci_obj);
- $this->assertAttributeInstanceOf($model, $name, $this->ci_obj);
+ $this->assertObjectHasAttribute($name, $this->ci_obj);
+ $this->assertInstanceOf($base, $this->ci_obj->$name);
+ $this->assertInstanceOf($model, $this->ci_obj->$name);
// Test name conflict
$obj = 'conflict';
@@ -567,15 +575,18 @@ class Loader_test extends CI_TestCase {
// Verify library
$this->assertTrue(class_exists($lib_class), $lib_class.' does not exist');
- $this->assertAttributeInstanceOf($lib_class, $lib, $this->ci_obj);
+ $this->assertObjectHasAttribute($lib, $this->ci_obj);
+ $this->assertInstanceOf($lib_class, $this->ci_obj->$lib);
// Verify driver
$this->assertTrue(class_exists($drv_class), $drv_class.' does not exist');
- $this->assertAttributeInstanceOf($drv_class, $drv, $this->ci_obj);
+ $this->assertObjectHasAttribute($drv, $this->ci_obj);
+ $this->assertInstanceOf($drv_class, $this->ci_obj->$drv);
// Verify model
$this->assertTrue(class_exists($model), $model.' does not exist');
- $this->assertAttributeInstanceOf($model, $model, $this->ci_obj);
+ $this->assertObjectHasAttribute($model, $this->ci_obj);
+ $this->assertInstanceOf($model, $this->ci_obj->$model);
// Verify config calls
$this->assertEquals($cfg['config'], $this->ci_obj->config->loaded);
diff --git a/tests/codeigniter/core/Security_test.php b/tests/codeigniter/core/Security_test.php
index c3113adba..5f94e1501 100644
--- a/tests/codeigniter/core/Security_test.php
+++ b/tests/codeigniter/core/Security_test.php
@@ -252,7 +252,7 @@ class Security_test extends CI_TestCase {
// Perform hash
$this->security->xss_hash();
- $this->assertRegExp('#^[0-9a-f]{32}$#iS', $this->security->xss_hash);
+ $this->assertMatchesRegularExpression('#^[0-9a-f]{32}$#iS', $this->security->xss_hash);
}
// --------------------------------------------------------------------
diff --git a/tests/codeigniter/core/compat/mbstring_test.php b/tests/codeigniter/core/compat/mbstring_test.php
index 415222446..8b8629efc 100644
--- a/tests/codeigniter/core/compat/mbstring_test.php
+++ b/tests/codeigniter/core/compat/mbstring_test.php
@@ -27,7 +27,7 @@ class mbstring_test extends CI_TestCase {
// ------------------------------------------------------------------------
/**
- * @depends test_boostrap
+ * @depends test_bootstrap
*/
public function test_mb_strpos()
{
@@ -39,7 +39,7 @@ class mbstring_test extends CI_TestCase {
// ------------------------------------------------------------------------
/**
- * @depends test_boostrap
+ * @depends test_bootstrap
*/
public function test_mb_substr()
{