Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Session library override if running tests
class MY_Session extends CI_Session {
protected $cliTestingDriver = 'codeception';
public function __construct(array $params = array())
/** alow for sessions ot be saved if in CLI mode and running tests */
if (is_cli() && defined('CODECEPTION_TEST')) {
$this->valid_drivers = array_merge($this->valid_drivers, array($this->cliTestingDriver));
// Save a copy of parameters in case drivers need access
$this->params = $params;
// Load driver and get array reference
// Delete 'old' flashdata (from last request)
// Mark all new flashdata as old (data will be deleted before next request)
// Delete expired tempdata
log_message('debug', 'MY_Session routines successfully run with Testing driver "'.$this->cliTestingDriver.'"');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.