/** * Verifies a user and returns its DAO * * @param Users $user * @return type */ public static function verifyUser(Users $user) { UserController::apiVerifyEmail(new Request(array('id' => $user->getVerificationId()))); // Get user from db again to pick up verification changes return UsersDAO::FindByUsername($user->getUsername()); }
/** * Normal user trying to go the admin path * * @expectedException ForbiddenAccessException */ public function testUsernameVerificationByAdminNotAdmin() { // User to be verified $user = UserFactory::createUser(null, null, null, false); // Another user will try to verify $user $user2 = UserFactory::createUser(); // Call api using admin $response = UserController::apiVerifyEmail(new Request(array('auth_token' => $this->login($user2), 'usernameOrEmail' => $user->getUsername()))); }