예제 #1
0
 /**
  * test grabbing a Crew that does not exist
  **/
 public function testGetInvalidCrewByCrewID()
 {
     //grab a profile id that exceeds the maximum allowable profileid
     $crew = Crew::getCrewByCrewId($this->getPDO(), TimecrunchersTest::INVALID_KEY);
     $this->assertNull($crew);
 }
예제 #2
0
                 throw new RuntimeException("Crew does not exist", 404);
             }
             $crew->setCrewLocation($requestObject->crewLocation);
             $crew->update($pdo);
             $reply->message = "Crew updated OK";
         } else {
             if ($method === "POST") {
                 $crew = new Crew(null, $requestObject->crewCompanyId, $requestObject->crewLocation);
                 $crew->insert($pdo);
                 $reply->message = "Crew created OK";
             }
         }
     } else {
         if ($method === "DELETE") {
             verifyXsrf();
             $crew = Crew::getCrewByCrewId($pdo, $id);
             if ($crew === null) {
                 throw new RuntimeException("Crew does not exist", 404);
             }
             $crew->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 administrators are allowed to modify entries", 401);
     }
 }