model = new UserSessionModel($this->db); $this->config = new AauthConfig(); } //-------------------------------------------------------------------- public function testDelete() { $id = md5(time()); $this->hasInDatabase($this->config->dbTableUserSessions, [ 'id' => $id, 'ip_address' => '127.0.0.1', 'timestamp' => time(), 'data' => '', ]); $this->seeNumRecords(1, $this->config->dbTableUserSessions, []); $this->model->delete($id); $this->seeNumRecords(0, $this->config->dbTableUserSessions, []); } public function testDBInsert() { $this->seeNumRecords(0, $this->config->dbTableUserSessions, []); $id = md5(time()); $this->model->insert([ 'id' => $id, 'ip_address' => '127.0.0.1', 'timestamp' => time(), 'data' => '', ]); $this->seeNumRecords(1, $this->config->dbTableUserSessions, []); $this->assertEquals(1, $this->model->affectedRows()); $this->assertEquals(1, $this->model->countAll()); } }