public function actionDelete($email) { $exitCode = 0; $this->stdout("Deleting {$email}: "); $deleteCounter = User::deleteAll(['email' => $email]); if (1 === $deleteCounter) { $this->msgSuccess(); } else { //Error Handling if ($deleteCounter === 0) { $exitCode = 1; $this->msgError("Account Not Found"); } else { $this->msgError("Multiple Accounts Deleted - DB may be in Inconsistent State"); $this->stderr("Multiple Accounts Deleted - DB may be in Inconsistent State", Console::BG_BLUE); $exitCode = 2; } } $this->stdout("\n"); return $exitCode; }
/** * Delete all users, who have status - pending. */ public function actionDeletePendingUsers() { User::deleteAll(['status' => User::STATUS_UNCONFIRMED_EMAIL]); return $this->redirect(['index']); }
/** * This method is called after each cest class test method, even if test failed. * @param \Codeception\Event\Test $event */ public function _after($event) { User::deleteAll(['email' => '*****@*****.**', 'username' => 'tester']); }