/** * test grabbing a Crew by a location that does not exist **/ public function testGetInvalidCrewByCrewLocation() { //grab a company id that exceeds the maximum allowable company id $crew = Crew::getCrewByCrewLocation($this->getPDO(), "nobody ever went here"); $this->assertNull($crew); }
setXsrfCookie("/"); //get the crew based on the given field if (empty($id) === false) { $crew = Crew::getCrewByCrewId($pdo, $id); if ($crew !== null && $crew->getCrewId() === $_SESSION["user"]->getUserCrewId()) { $reply->data = $crew; } } else { if (empty($crewCompanyId) === false) { $crew = Crew::getCrewByCrewCompanyId($pdo, $crewCompanyId); if ($crew !== null && $crew->getCrewId() === $_SESSION["user"]->getUserCrewId()) { $reply->data = $crew; } } else { if (empty($crewLocation) === false) { $crew = Crew::getCrewByCrewLocation($pdo, $crewLocation); if ($crew !== null && $crew->getCrewId() === $_SESSION["user"]->getUserCrewId()) { $reply->data = $crew; } } } } } else { if ($method === "PUT" || $method === "POST" || $method === "DELETE") { // block non-admin users from doing admin-only tasks if (Access::isAdminLoggedIn() === true) { if ($method === "PUT" || $method === "POST") { verifyXsrf(); $requestContent = file_get_contents("php://input"); $requestObject = json_decode($requestContent); if (empty($requestObject->crewCompanyId) === true) {