//should already have checked if they're a volunteer, so another check here would be redundant if ($method === "GET") { //set XSRF cookie setXsrfCookie("/"); //get the organization based on the given field if (empty($id) === false) { $reply->data = Organization::getOrganizationByOrgId($pdo, $id); } else { if (empty($city) === false) { $reply->data = Organization::getOrganizationByOrgCity($pdo, $city)->toArray(); } else { if (empty($name) === false) { $reply->data = Organization::getOrganizationByOrgName($pdo, $name)->toArray(); } else { if (empty($type) === false) { $reply->data = Organization::getOrganizationByOrgType($pdo, $type)->toArray(); } else { if (empty($zip) === false) { $reply->data = Organization::getOrganizationByOrgZip($pdo, $zip)->toArray(); } else { if (empty($current) === false) { //used to fetch the current organization info for angular $reply->data = Organization::getOrganizationByOrgId($pdo, $_SESSION["volunteer"]->getOrgId()); } else { $reply->data = Organization::getAllOrganizations($pdo)->toArray(); } } } } } }
/** * test for grabbing an organization by type that does not exist */ public function testGetInvalidOrganizationByType() { $organization = Organization::getOrganizationByOrgType($this->getPDO(), "Z"); $this->assertSame($organization->getSize(), 0); }