Exemplo n.º 1
0
 /**
  * test grabbing a Tweet that does not exist
  **/
 public function testGetInvalidUserByUserId()
 {
     //grab a user id that exceeds the maximum allowable user id
     $user = User::getUserByUserId($this->getPDO(), TimeCrunchersTest::INVALID_KEY);
     $this->assertNull($user);
 }
Exemplo n.º 2
0
<p><a href="{$confirmLink}">{$confirmLink}</a></p>
EOF;
                        $response = sendEmail($user->getUserEmail(), $user->getUserFirstName(), $user->getUserLastName(), $messageSubject, $message);
                        if ($response === "Email sent.") {
                            $reply->message = "sign up was successful, please check your email for activation message.";
                        }
                        /**
                         * the send method returns the number of recipients that accepted the Email
                         * so, if the number attempted is not the number accepted, this is an Exception
                         **/
                    }
                }
            } else {
                if ($method === "DELETE") {
                    $reply->debug = "delete started";
                    $user = User::getUserByUserId($pdo, $id);
                    if ($user === null) {
                        throw new RuntimeException("User does not exist", 404);
                    }
                    $user->delete($pdo);
                    $deletedObject = new stdClass();
                    $deletedObject->crewId = $id;
                    $reply->message = "Crew deleted OK";
                } else {
                    //if not an admin, and attempting a method other than get, throw an exception
                    if (empty($method) === false && $method !== "GET") {
                        throw new RuntimeException("only admins can change database entries", 401);
                    }
                }
            }
        }