<?php
class Encrypt_test extends CI_TestCase {
public function set_up()
{
$cls =& $this->ci_core_class('cfg');
$this->ci_set_config(array(
'encryption_key' => 'OHAI'
));
$this->config = new $cls;
$obj = new StdClass;
$obj->encrypt = new Mock_Libraries_Encrypt();
$this->ci_instance($obj);
$this->encrypt = $obj->encrypt;
}
// --------------------------------------------------------------------
public function test_encode()
{
$msg = 'My secret message';
$encrypted_string = $this->encrypt->encode($msg);
}
}
There was 1 error:
1) Encrypt_test::test_encode
Undefined property: stdClass::$config
/Applications/MAMP/htdocs/codeigniter/system/libraries/Encrypt.php:108
/Applications/MAMP/htdocs/codeigniter/system/libraries/Encrypt.php:153
/Applications/MAMP/htdocs/codeigniter/tests/codeigniter/libraries/Encrypt_test.php:33
/Applications/MAMP/htdocs/codeigniter/tests/mocks/ci_testcase.php:168
Line 108 is :
$key = $CI->config->item('encryption_key');