summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/libraries')
-rw-r--r--tests/codeigniter/libraries/Encryption_test.php11
-rw-r--r--tests/codeigniter/libraries/Session_test.php2
-rw-r--r--tests/codeigniter/libraries/Table_test.php51
3 files changed, 38 insertions, 26 deletions
diff --git a/tests/codeigniter/libraries/Encryption_test.php b/tests/codeigniter/libraries/Encryption_test.php
index 54db2b42d..a8b5bc81e 100644
--- a/tests/codeigniter/libraries/Encryption_test.php
+++ b/tests/codeigniter/libraries/Encryption_test.php
@@ -179,6 +179,9 @@ class Encryption_test extends CI_TestCase {
* Testing the three methods separately is not realistic as they are
* designed to work together. A more thorough test for initialize()
* though is the OpenSSL/MCrypt compatibility test.
+ *
+ * @depends test_hkdf
+ * @depends test__get_params
*/
public function test_initialize_encrypt_decrypt()
{
@@ -202,6 +205,8 @@ class Encryption_test extends CI_TestCase {
/**
* encrypt(), decrypt test with custom parameters
+ *
+ * @depends test___get_params
*/
public function test_encrypt_decrypt_custom()
{
@@ -239,7 +244,7 @@ class Encryption_test extends CI_TestCase {
{
if ($this->encryption->drivers['mcrypt'] === FALSE)
{
- return $this->markTestAsSkipped('Cannot test MCrypt because it is not available.');
+ return $this->markTestSkipped('Cannot test MCrypt because it is not available.');
}
$this->assertTrue(is_resource($this->encryption->__driver_get_handle('mcrypt', 'rijndael-128', 'cbc')));
@@ -254,7 +259,7 @@ class Encryption_test extends CI_TestCase {
{
if ($this->encryption->drivers['openssl'] === FALSE)
{
- return $this->markTestAsSkipped('Cannot test OpenSSL because it is not available.');
+ return $this->markTestSkipped('Cannot test OpenSSL because it is not available.');
}
$this->assertEquals('aes-128-cbc', $this->encryption->__driver_get_handle('openssl', 'aes-128', 'cbc'));
@@ -272,7 +277,7 @@ class Encryption_test extends CI_TestCase {
{
if ( ! $this->encryption->drivers['mcrypt'] OR ! $this->encryption->drivers['openssl'])
{
- $this->markTestAsSkipped('Both MCrypt and OpenSSL support are required for portability tests.');
+ $this->markTestSkipped('Both MCrypt and OpenSSL support are required for portability tests.');
return;
}
diff --git a/tests/codeigniter/libraries/Session_test.php b/tests/codeigniter/libraries/Session_test.php
index 97e9444ee..6f1332384 100644
--- a/tests/codeigniter/libraries/Session_test.php
+++ b/tests/codeigniter/libraries/Session_test.php
@@ -91,7 +91,7 @@ class Session_test extends CI_TestCase {
$cmsg1 = 'Some test data';
$cmsg2 = 42;
$nmsg1 = 'Other test data';
- $nmsg2 = true;
+ $nmsg2 = TRUE;
$this->session->cookie->set_userdata($key1, $cmsg1);
$this->session->set_userdata($ckey2, $cmsg2);
$this->session->native->set_userdata($key1, $nmsg1);
diff --git a/tests/codeigniter/libraries/Table_test.php b/tests/codeigniter/libraries/Table_test.php
index ce04b6a6d..8e7452474 100644
--- a/tests/codeigniter/libraries/Table_test.php
+++ b/tests/codeigniter/libraries/Table_test.php
@@ -34,7 +34,7 @@ class Table_test extends CI_TestCase {
}
/*
- * @depends testPrepArgs
+ * @depends test_prep_args
*/
public function test_set_heading()
{
@@ -55,7 +55,7 @@ class Table_test extends CI_TestCase {
}
/*
- * @depends testPrepArgs
+ * @depends test_prep_args
*/
public function test_add_row()
{
@@ -200,16 +200,14 @@ class Table_test extends CI_TestCase {
public function test_set_from_array()
{
- $this->assertFalse($this->table->set_from_array('bogus'));
- $this->assertFalse($this->table->set_from_array(NULL));
-
$data = array(
array('name', 'color', 'number'),
array('Laura', 'Red', '22'),
array('Katie', 'Blue')
);
- $this->table->set_from_array($data, FALSE);
+ $this->table->auto_heading = FALSE;
+ $this->table->set_from_array($data);
$this->assertEmpty($this->table->heading);
$this->table->clear();
@@ -235,22 +233,14 @@ class Table_test extends CI_TestCase {
public function test_set_from_object()
{
- // Make a stub of query instance
- $query = new CI_TestCase();
- $query->list_fields = function(){
- return array('name', 'email');
- };
- $query->result_array = function(){
- return array(
- array('name' => 'John Doe', 'email' => 'john@doe.com'),
- array('name' => 'Foo Bar', 'email' => 'foo@bar.com'),
- );
- };
- $query->num_rows = function(){
- return 2;
- };
-
- $this->table->set_from_object($query);
+ // This needs to be passed by reference to CI_DB_result::__construct()
+ $dummy = new stdClass();
+ $dummy->conn_id = NULL;
+ $dummy->result_id = NULL;
+
+ $db_result = new DB_result_dummy($dummy);
+
+ $this->table->set_from_db_result($db_result);
$expected = array(
array('data' => 'name'),
@@ -290,4 +280,21 @@ class Table_test extends CI_TestCase {
$this->assertTrue(strpos($table, '<td>Small</td>') !== FALSE);
}
+}
+
+// We need this for the _set_from_db_result() test
+class DB_result_dummy extends CI_DB_result
+{
+ public function list_fields()
+ {
+ return array('name', 'email');
+ }
+
+ public function result_array()
+ {
+ return array(
+ array('name' => 'John Doe', 'email' => 'john@doe.com'),
+ array('name' => 'Foo Bar', 'email' => 'foo@bar.com')
+ );
+ }
} \ No newline at end of file