public function setUp() { $this->di = new \Phalcon\DI\FactoryDefault(); $this->di->setShared('db', function () { $db = new TestDatabase(); $db->cleanUp(); $db->constructUsers(); return $db; }); $this->di->setShared('session', function () { $adapter = new TestSession(); $adapter->start(); return $adapter; }); $this->di->set('auth', new \AD\Auth\Security\Auth(new \Phalcon\Config(array('session_key' => 'testkey', 'hash_key' => 'hashkey', 'hash_method' => 'sha256')), '\\TestUser')); \Phalcon\DI::setDefault($this->di); }