From 98e6dd2d6aaf8ee1db1923c27ff83f3b5fc5fa90 Mon Sep 17 00:00:00 2001 From: Niel Buys Date: Wed, 28 Feb 2024 14:02:36 +0200 Subject: [PATCH] Fix test --- tests/codeigniter/core/Loader_test.php | 28 ++++++++++----------- tests/codeigniter/libraries/Driver_test.php | 8 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index 5fc4735ea55..94491f396ac 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -36,7 +36,7 @@ public function test_library() // Test loading as an array. $this->assertInstanceOf('CI_Loader', $this->load->library(array($lib))); $this->assertTrue(class_exists($class), $class.' does not exist'); - $this->assertObjectHasAttribute($lib, $this->ci_obj); + $this->assertObjectHasProperty($lib, $this->ci_obj); $this->assertInstanceOf($class, $this->ci_obj->$lib); // Create library in VFS @@ -88,21 +88,21 @@ public function test_library_extension() $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->assertObjectHasAttribute($name, $this->ci_obj); + $this->assertObjectHasProperty($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->assertObjectHasAttribute($obj, $this->ci_obj); + $this->assertObjectHasProperty($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); $this->assertInstanceOf('CI_Loader', $this->load->library($lib)); - $this->assertObjectHasAttribute($name, $this->ci_obj); + $this->assertObjectHasProperty($name, $this->ci_obj); // Create baseless library $name = 'ext_baseless_lib'; @@ -140,7 +140,7 @@ public function test_library_config() $obj = 'testy'; $this->assertInstanceOf('CI_Loader', $this->load->library($lib, NULL, $obj)); $this->assertTrue(class_exists($class), $class.' does not exist'); - $this->assertObjectHasAttribute($obj, $this->ci_obj); + $this->assertObjectHasProperty($obj, $this->ci_obj); $this->assertInstanceOf($class, $this->ci_obj->$obj); $this->assertEquals($cfg, $this->ci_obj->$obj->config); @@ -172,7 +172,7 @@ public function test_load_library_in_application_dir() // Was the model class instantiated. $this->assertTrue(class_exists($class), $class.' does not exist'); - $this->assertObjectHasAttribute($lib, $this->ci_obj); + $this->assertObjectHasProperty($lib, $this->ci_obj); $this->assertInstanceOf($class, $this->ci_obj->$lib); } @@ -193,13 +193,13 @@ class_exists('CI_Driver_Library', TRUE); // Test loading as an array. $this->assertInstanceOf('CI_Loader', $this->load->driver(array($driver))); $this->assertTrue(class_exists($class), $class.' does not exist'); - $this->assertObjectHasAttribute($driver, $this->ci_obj); + $this->assertObjectHasProperty($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->assertObjectHasAttribute($obj, $this->ci_obj); + $this->assertObjectHasProperty($obj, $this->ci_obj); $this->assertInstanceOf($class, $this->ci_obj->$obj); // Test a string given to params @@ -222,7 +222,7 @@ public function test_models() // Was the model class instantiated. $this->assertTrue(class_exists($model)); - $this->assertObjectHasAttribute($model, $this->ci_obj); + $this->assertObjectHasProperty($model, $this->ci_obj); // Test no model given $this->assertInstanceOf('CI_Loader', $this->load->model('')); @@ -248,8 +248,8 @@ public function test_model_subdir() // Was the model class instantiated? $this->assertTrue(class_exists($model)); - $this->assertObjectHasAttribute($name, $this->ci_obj); - $this->assertObjectHasAttribute($name, $this->ci_obj); + $this->assertObjectHasProperty($name, $this->ci_obj); + $this->assertObjectHasProperty($name, $this->ci_obj); $this->assertInstanceOf($base, $this->ci_obj->$name); $this->assertInstanceOf($model, $this->ci_obj->$name); @@ -575,17 +575,17 @@ public function test_initialize() // Verify library $this->assertTrue(class_exists($lib_class), $lib_class.' does not exist'); - $this->assertObjectHasAttribute($lib, $this->ci_obj); + $this->assertObjectHasProperty($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->assertObjectHasAttribute($drv, $this->ci_obj); + $this->assertObjectHasProperty($drv, $this->ci_obj); $this->assertInstanceOf($drv_class, $this->ci_obj->$drv); // Verify model $this->assertTrue(class_exists($model), $model.' does not exist'); - $this->assertObjectHasAttribute($model, $this->ci_obj); + $this->assertObjectHasProperty($model, $this->ci_obj); $this->assertInstanceOf($model, $this->ci_obj->$model); // Verify config calls diff --git a/tests/codeigniter/libraries/Driver_test.php b/tests/codeigniter/libraries/Driver_test.php index ea5cfa235f8..5089bb851e1 100644 --- a/tests/codeigniter/libraries/Driver_test.php +++ b/tests/codeigniter/libraries/Driver_test.php @@ -51,12 +51,12 @@ public function test_load_driver() $this->assertEquals($this->name, $this->lib->get_name()); // Was driver loaded? - $this->assertObjectHasAttribute($driver, $this->lib); + $this->assertObjectHasProperty($driver, $this->lib); $this->assertInstanceOf($class, $this->lib->$driver); $this->assertInstanceOf('CI_Driver', $this->lib->$driver); // Was decorate called? - $this->assertObjectHasAttribute($prop, $this->lib->$driver); + $this->assertObjectHasProperty($prop, $this->lib->$driver); $this->assertTrue($this->lib->$driver->$prop); // Do we get an error for an invalid driver? @@ -86,7 +86,7 @@ public function test_load_app_driver() $this->assertNotNull($this->lib->load_driver($driver)); // Was driver loaded? - $this->assertObjectHasAttribute($driver, $this->lib); + $this->assertObjectHasProperty($driver, $this->lib); $this->assertInstanceOf($class, $this->lib->$driver); $this->assertInstanceOf('CI_Driver', $this->lib->$driver); @@ -120,7 +120,7 @@ public function test_load_driver_ext() $this->assertNotNull($this->lib->load_driver($driver)); // Was driver loaded? - $this->assertObjectHasAttribute($driver, $this->lib); + $this->assertObjectHasProperty($driver, $this->lib); $this->assertInstanceOf($class, $this->lib->$driver); $this->assertInstanceOf($baseclass, $this->lib->$driver); $this->assertInstanceOf('CI_Driver', $this->lib->$driver);