summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/libraries')
-rw-r--r--tests/codeigniter/libraries/Driver_test.php16
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php4
-rw-r--r--tests/codeigniter/libraries/Form_validation_test.php3
-rw-r--r--tests/codeigniter/libraries/Table_test.php12
-rw-r--r--tests/codeigniter/libraries/Useragent_test.php4
5 files changed, 22 insertions, 17 deletions
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/Form_validation_test.php b/tests/codeigniter/libraries/Form_validation_test.php
index 04bd670ad..1bafd50c3 100644
--- a/tests/codeigniter/libraries/Form_validation_test.php
+++ b/tests/codeigniter/libraries/Form_validation_test.php
@@ -266,6 +266,9 @@ class Form_validation_test extends CI_TestCase {
// URI scheme case-sensitivity: https://github.com/bcit-ci/CodeIgniter/pull/4758
$this->assertTrue($this->form_validation->valid_url('HtTp://127.0.0.1/'));
+ // https://github.com/bcit-ci/CodeIgniter/issues/5755
+ $this->assertFalse($this->form_validation->valid_url('1'));
+
$this->assertFalse($this->form_validation->valid_url('htt://www.codeIgniter.com'));
$this->assertFalse($this->form_validation->valid_url(''));
$this->assertFalse($this->form_validation->valid_url('code igniter'));
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('<th>Name</th>', $table);
- $this->assertContains('<th>Color</th>', $table);
- $this->assertContains('<th>Size</th>', $table);
+ $this->assertEquals(1, substr_count($table, '<th>Name</th>'));
+ $this->assertEquals(1, substr_count($table, '<th>Color</th>'));
+ $this->assertEquals(1, substr_count($table, '<th>Size</th>'));
// Test the first entry
- $this->assertContains('<td>Fred</td>', $table);
- $this->assertContains('<td>Blue</td>', $table);
- $this->assertContains('<td>Small</td>', $table);
+ $this->assertEquals(1, substr_count($table, '<td>Fred</td>'));
+ $this->assertEquals(1, substr_count($table, '<td>Blue</td>'));
+ $this->assertEquals(1, substr_count($table, '<td>Small</td>'));
}
}
diff --git a/tests/codeigniter/libraries/Useragent_test.php b/tests/codeigniter/libraries/Useragent_test.php
index c02f2bd9d..087544a1a 100644
--- a/tests/codeigniter/libraries/Useragent_test.php
+++ b/tests/codeigniter/libraries/Useragent_test.php
@@ -51,9 +51,9 @@ class UserAgent_test extends CI_TestCase {
public function test_referrer()
{
- $_SERVER['HTTP_REFERER'] = 'http://codeigniter.com/user_guide/';
+ $_SERVER['HTTP_REFERER'] = 'http://codeigniter.com/userguide3/';
$this->assertTrue($this->agent->is_referral());
- $this->assertEquals('http://codeigniter.com/user_guide/', $this->agent->referrer());
+ $this->assertEquals('http://codeigniter.com/userguide3/', $this->agent->referrer());
$this->agent->referer = NULL;
unset($_SERVER['HTTP_REFERER']);