Merge pull request #5354 from carusogabriel/refactoring-tests

Refactoring tests

Conflicts resolved:
	tests/codeigniter/core/Utf8_test.php
	tests/codeigniter/database/query_builder/group_test.php
	tests/codeigniter/libraries/Form_validation_test.php
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php
index 99c5d4b..8e411d9 100644
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -151,7 +151,7 @@
 			'hmac_key' => str_repeat("\x0", 16)
 		);
 
-		$this->assertTrue(is_array($this->encryption->__get_params($params)));
+		$this->assertInternalType('array', $this->encryption->__get_params($params));
 
 		$params['base64'] = TRUE;
 		$params['hmac_digest'] = 'sha512';
@@ -257,7 +257,7 @@
 			return $this->markTestSkipped('ext/mcrypt is deprecated since PHP 7.1 and will generate notices here.');
 		}
 
-		$this->assertTrue(is_resource($this->encryption->__driver_get_handle('mcrypt', 'rijndael-128', 'cbc')));
+		$this->assertInternalType('resource', $this->encryption->__driver_get_handle('mcrypt', 'rijndael-128', 'cbc'));
 	}
 
 	// --------------------------------------------------------------------
diff --git a/tests/codeigniter/libraries/Form_validation_test.php b/tests/codeigniter/libraries/Form_validation_test.php
index fa9e86c..3280f5b 100644
--- a/tests/codeigniter/libraries/Form_validation_test.php
+++ b/tests/codeigniter/libraries/Form_validation_test.php
@@ -358,7 +358,7 @@
 		$this->form_validation->run();
 		$error_msg = $this->form_validation->error('foo');
 
-		$this->assertTrue(strrpos($error_msg, $prefix) === 0);
+		$this->assertStringStartsWith($prefix, $error_msg);
 		$this->assertTrue(strrpos($error_msg, $suffix, -strlen($suffix)) === (strlen($error_msg) - strlen($suffix)));
 
 		$_POST = array();
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php
index 8e74524..f505a43 100644
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -67,7 +67,7 @@
 		$this->table->add_row('your', 'pony', 'stinks');
 		$this->table->add_row('my pony', '>', 'your pony');
 
-		$this->assertEquals(count($this->table->rows), 3);
+		$this->assertCount(3, $this->table->rows);
 
 		$this->assertEquals(
 			array(
@@ -188,8 +188,8 @@
 		}
 
 		$this->assertFalse($this->table->auto_heading);
-		$this->assertEquals(count($this->table->heading), 3);
-		$this->assertEquals(count($this->table->rows), 2);
+		$this->assertCount(3, $this->table->heading);
+		$this->assertCount(2, $this->table->rows);
 
 		$this->table->clear();
 
@@ -213,7 +213,7 @@
 		$this->table->clear();
 
 		$this->table->set_from_array($data);
-		$this->assertEquals(count($this->table->rows), 2);
+		$this->assertCount(2, $this->table->rows);
 
 		$expected = array(
 			array('data' => 'name'),
@@ -270,14 +270,14 @@
 		$table = $this->table->generate($data);
 
 		// Test the table header
-		$this->assertTrue(strpos($table, '<th>Name</th>') !== FALSE);
-		$this->assertTrue(strpos($table, '<th>Color</th>') !== FALSE);
-		$this->assertTrue(strpos($table, '<th>Size</th>') !== FALSE);
+		$this->assertContains('<th>Name</th>', $table);
+		$this->assertContains('<th>Color</th>', $table);
+		$this->assertContains('<th>Size</th>', $table);
 
 		// Test the first entry
-		$this->assertTrue(strpos($table, '<td>Fred</td>') !== FALSE);
-		$this->assertTrue(strpos($table, '<td>Blue</td>') !== FALSE);
-		$this->assertTrue(strpos($table, '<td>Small</td>') !== FALSE);
+		$this->assertContains('<td>Fred</td>', $table);
+		$this->assertContains('<td>Blue</td>', $table);
+		$this->assertContains('<td>Small</td>', $table);
 	}
 
 }
@@ -297,4 +297,4 @@
 			array('name' => 'Foo Bar', 'email' => 'foo@bar.com')
 		);
 	}
-}
\ No newline at end of file
+}