summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/libraries/Encrypt_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/libraries/Encrypt_test.php')
-rw-r--r--tests/codeigniter/libraries/Encrypt_test.php32
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/codeigniter/libraries/Encrypt_test.php b/tests/codeigniter/libraries/Encrypt_test.php
index 153a25e1d..21ac85f03 100644
--- a/tests/codeigniter/libraries/Encrypt_test.php
+++ b/tests/codeigniter/libraries/Encrypt_test.php
@@ -4,14 +4,12 @@ class Encrypt_test extends CI_TestCase {
public function set_up()
{
- $obj = new stdClass;
- $obj->encrypt = new Mock_Libraries_Encrypt();
-
- $this->ci_instance($obj);
- $this->encrypt = $obj->encrypt;
+ $this->encrypt = new Mock_Libraries_Encrypt();
+ $this->ci_instance_var('encrypt', $this->encrypt);
$this->ci_set_config('encryption_key', "Encryptin'glike@boss!");
$this->msg = 'My secret message';
+ $this->mcrypt = extension_loaded('mcrypt');
}
// --------------------------------------------------------------------
@@ -42,6 +40,12 @@ class Encrypt_test extends CI_TestCase {
public function test_default_cipher()
{
+ if ( ! $this->mcrypt)
+ {
+ $this->markTestSkipped('MCrypt not available');
+ return;
+ }
+
$this->assertEquals('rijndael-256', $this->encrypt->get_cipher());
}
@@ -50,6 +54,12 @@ class Encrypt_test extends CI_TestCase {
public function test_set_cipher()
{
+ if ( ! $this->mcrypt)
+ {
+ $this->markTestSkipped('MCrypt not available');
+ return;
+ }
+
$this->encrypt->set_cipher(MCRYPT_BLOWFISH);
$this->assertEquals('blowfish', $this->encrypt->get_cipher());
}
@@ -58,6 +68,12 @@ class Encrypt_test extends CI_TestCase {
public function test_default_mode()
{
+ if ( ! $this->mcrypt)
+ {
+ $this->markTestSkipped('MCrypt not available');
+ return;
+ }
+
$this->assertEquals('cbc', $this->encrypt->get_mode());
}
@@ -65,6 +81,12 @@ class Encrypt_test extends CI_TestCase {
public function test_set_mode()
{
+ if ( ! $this->mcrypt)
+ {
+ $this->markTestSkipped('MCrypt not available');
+ return;
+ }
+
$this->encrypt->set_mode(MCRYPT_MODE_CFB);
$this->assertEquals('cfb', $this->encrypt->get_mode());
}