From 74384ca7f88913b87e982696bb5cb3eb5593c451 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 20 Dec 2021 15:47:39 +0200 Subject: Merge pull request #6074 from philsturgeon/ci3-php8 CodeIgniter 3.0 on PHP 8 --- tests/codeigniter/libraries/Driver_test.php | 16 +++++++++------- tests/codeigniter/libraries/Encryption_test.php | 4 ++-- tests/codeigniter/libraries/Table_test.php | 12 ++++++------ 3 files changed, 17 insertions(+), 15 deletions(-) (limited to 'tests/codeigniter/libraries') diff --git a/tests/codeigniter/libraries/Driver_test.php b/tests/codeigniter/libraries/Driver_test.php index e4401e688..ea5cfa235 100644 --- a/tests/codeigniter/libraries/Driver_test.php +++ b/tests/codeigniter/libraries/Driver_test.php @@ -5,6 +5,8 @@ */ class Driver_test extends CI_TestCase { + private $name; + /** * Set up test framework */ @@ -50,8 +52,8 @@ class Driver_test extends CI_TestCase { // Was driver loaded? $this->assertObjectHasAttribute($driver, $this->lib); - $this->assertAttributeInstanceOf($class, $driver, $this->lib); - $this->assertAttributeInstanceOf('CI_Driver', $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); @@ -85,8 +87,8 @@ class Driver_test extends CI_TestCase { // Was driver loaded? $this->assertObjectHasAttribute($driver, $this->lib); - $this->assertAttributeInstanceOf($class, $driver, $this->lib); - $this->assertAttributeInstanceOf('CI_Driver', $driver, $this->lib); + $this->assertInstanceOf($class, $this->lib->$driver); + $this->assertInstanceOf('CI_Driver', $this->lib->$driver); // Do we get an error for a non-existent driver? $this->setExpectedException('RuntimeException', 'CI Error: Unable to load the requested driver: CI_'. @@ -119,9 +121,9 @@ class Driver_test extends CI_TestCase { // Was driver loaded? $this->assertObjectHasAttribute($driver, $this->lib); - $this->assertAttributeInstanceOf($class, $driver, $this->lib); - $this->assertAttributeInstanceOf($baseclass, $driver, $this->lib); - $this->assertAttributeInstanceOf('CI_Driver', $driver, $this->lib); + $this->assertInstanceOf($class, $this->lib->$driver); + $this->assertInstanceOf($baseclass, $this->lib->$driver); + $this->assertInstanceOf('CI_Driver', $this->lib->$driver); // Create driver extension without base $driver = 'baseless'; diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php index 8e411d9fa..68bc3d804 100644 --- a/tests/codeigniter/libraries/Encryption_test.php +++ b/tests/codeigniter/libraries/Encryption_test.php @@ -151,7 +151,7 @@ class Encryption_test extends CI_TestCase { 'hmac_key' => str_repeat("\x0", 16) ); - $this->assertInternalType('array', $this->encryption->__get_params($params)); + $this->assertEquals('array', gettype($this->encryption->__get_params($params))); $params['base64'] = TRUE; $params['hmac_digest'] = 'sha512'; @@ -217,7 +217,7 @@ class Encryption_test extends CI_TestCase { /** * encrypt(), decrypt test with custom parameters * - * @depends test___get_params + * @depends test__get_params */ public function test_encrypt_decrypt_custom() { diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php index f505a43fc..6efae5d18 100644 --- a/tests/codeigniter/libraries/Table_test.php +++ b/tests/codeigniter/libraries/Table_test.php @@ -270,14 +270,14 @@ class Table_test extends CI_TestCase { $table = $this->table->generate($data); // Test the table header - $this->assertContains('Name', $table); - $this->assertContains('Color', $table); - $this->assertContains('Size', $table); + $this->assertEquals(1, substr_count($table, 'Name')); + $this->assertEquals(1, substr_count($table, 'Color')); + $this->assertEquals(1, substr_count($table, 'Size')); // Test the first entry - $this->assertContains('Fred', $table); - $this->assertContains('Blue', $table); - $this->assertContains('Small', $table); + $this->assertEquals(1, substr_count($table, 'Fred')); + $this->assertEquals(1, substr_count($table, 'Blue')); + $this->assertEquals(1, substr_count($table, 'Small')); } } -- cgit v1.2.3-24-g4f1b