当前位置: 首页>>代码示例>>PHP>>正文


PHP Organization::getOrganizationByOrgName方法代码示例

本文整理汇总了PHP中Organization::getOrganizationByOrgName方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::getOrganizationByOrgName方法的具体用法?PHP Organization::getOrganizationByOrgName怎么用?PHP Organization::getOrganizationByOrgName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Organization的用法示例。


在下文中一共展示了Organization::getOrganizationByOrgName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetInvalidOrganizationByName

 /**
  * test for grabbing an organization by name that does not exist
  */
 public function testGetInvalidOrganizationByName()
 {
     $organization = Organization::getOrganizationByOrgName($this->getPDO(), "Let the Poor Starve");
     $this->assertSame($organization->getSize(), 0);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:8,代码来源:organization-test.php

示例2: filter_input

 $zip = filter_input(INPUT_GET, "zip", FILTER_SANITIZE_STRING);
 $current = filter_input(INPUT_GET, "current", FILTER_SANITIZE_STRING);
 //handle REST calls, while only allowing administrators access to database-modifying methods
 //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();
                         }
                     }
                 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:31,代码来源:index.php

示例3: testInvalidPost

 /**
  * test posting an invalid organization to the API
  */
 public function testInvalidPost()
 {
     //test to make sure non-admin can't post
     //sign out as an admin, log-in as a volunteer
     $logout = $this->guzzle->get('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/controllers/sign-out-controller.php');
     $volLogin = new stdClass();
     $volLogin->email = "notanemail@fake.com";
     $volLogin->password = "password1234";
     $login = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/controllers/sign-in-controller.php', ['allow_redirects' => ['strict' => true], 'json' => $volLogin, 'headers' => ['X-XSRF-TOKEN' => $this->token]]);
     //try to post to an organization
     $organization = new Organization(null, $this->VALID_ADDRESS1, $this->VALID_ADDRESS2, $this->VALID_CITY, $this->VALID_DESCRIPTION, $this->VALID_HOURS, $this->VALID_NAME, $this->VALID_PHONE, $this->VALID_STATE, $this->VALID_TYPE, $this->VALID_ZIP);
     $response = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/organization', ['allow_redirects' => ['strict' => true], 'json' => $organization, 'headers' => ['X-XSRF-TOKEN' => $this->token]]);
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $retrievedOrg = json_decode($body);
     //make sure the organization was not entered into the database
     $shouldNotExist = Organization::getOrganizationByOrgName($this->getPDO(), $this->VALID_NAME);
     $this->assertSame($shouldNotExist->getSize(), 0);
     //make sure 401 error is returned for trying to access an admin method as a volunteer
     $this->assertSame(401, $retrievedOrg->status);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:24,代码来源:org-api-test.php


注:本文中的Organization::getOrganizationByOrgName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。