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


PHP Organization::getOrgId方法代码示例

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


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

示例1: setUp

 /**
  * set up for dependent objects before running each test
  */
 public final function setUp()
 {
     //run default set-up method
     parent::setUp();
     //create a new organization for the test volunteers to belong
     $organization = new Organization(null, "123 Easy Street", '', "Albuquerque", "Feeding people since 1987", "9 - 5", "Food for Hungry People", "505-765-4321", "NM", "R", "87801");
     $organization->insert($this->getPDO());
     //create a new volunteer to use as an admin for the tests
     //don't need to insert them into the database: just need their info to create sessions
     //for testing purposes, allow them to create organizations they're not associated with
     $salt = bin2hex(openssl_random_pseudo_bytes(32));
     $hash = hash_pbkdf2("sha512", "password4321", $salt, 262144, 128);
     $this->admin = new Volunteer(null, $organization->getOrgId(), "fakeemail@fake.com", null, "John", $hash, true, "Doe", "505-123-4567", $salt);
     $this->admin->insert($this->getPDO());
     //create a non-admin volunteer for the tests
     $salt = bin2hex(openssl_random_pseudo_bytes(32));
     $hash = hash_pbkdf2("sha512", "password1234", $salt, 262144, 128);
     $this->volunteer = new Volunteer(null, $organization->getOrgId(), "notanemail@fake.com", null, "Jane", $hash, false, "Doe", "505-555-5555", $salt);
     $this->volunteer->insert($this->getPDO());
     //create the guzzle client
     $this->guzzle = new \GuzzleHttp\Client(["cookies" => true]);
     //visit ourselves to get the xsrf-token
     $this->guzzle->get('https://bootcamp-coders.cnm.edu/~tfenstermaker/bread-basket/public_html/php/api/organization');
     $cookies = $this->guzzle->getConfig()["cookies"];
     $this->token = $cookies->getCookieByName("XSRF-TOKEN")->getValue();
     //send a request to the sign-in method
     $adminLogin = new stdClass();
     $adminLogin->email = "fakeemail@fake.com";
     $adminLogin->password = "password4321";
     $login = $this->guzzle->post('https://bootcamp-coders.cnm.edu/~tfenstermaker/bread-basket/public_html/php/controllers/sign-in-controller.php', ['json' => $adminLogin, 'headers' => ['X-XSRF-TOKEN' => $this->token]]);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:34,代码来源:listing-type-api-test.php

示例2: RuntimeException

 $volEmail = filter_var($requestObject->volEmail, FILTER_SANITIZE_EMAIL);
 $volunteer = Volunteer::getVolunteerByVolEmail($pdo, $volEmail);
 if ($volunteer !== null) {
     throw new RuntimeException("This email already has an account", 422);
 }
 // create a new salt and email activation
 $volSalt = bin2hex(openssl_random_pseudo_bytes(32));
 $volEmailActivation = bin2hex(openssl_random_pseudo_bytes(8));
 // create the hash
 $volHash = hash_pbkdf2("sha512", $requestObject->password, $volSalt, 262144, 128);
 //create a new organization and insert into mySQL
 $organization = new Organization(null, $requestObject->orgAddress1, $requestObject->orgAddress2, $requestObject->orgCity, $requestObject->orgDescription, $requestObject->orgHours, $requestObject->orgName, $requestObject->orgPhone, $requestObject->orgState, $requestObject->orgType, $requestObject->orgZip);
 $organization->insert($pdo);
 $reply->message = "New organization has been created";
 //create a new Volunteer and insert into mySQL
 $volunteer = new Volunteer(null, $organization->getOrgId(), $requestObject->volEmail, $volEmailActivation, $requestObject->volFirstName, $volHash, true, $requestObject->volLastName, $requestObject->volPhone, $volSalt);
 $volunteer->insert($pdo);
 $reply->message = "A new administrator has been created";
 if ($volunteer->getVolIsAdmin() === true) {
     $_SESSION["volunteer"] = $volunteer;
     $reply->status = 200;
     $reply->message = "Logged in as administrator";
 }
 // create Swift message
 $swiftMessage = Swift_Message::newInstance();
 // attach the sender to the message
 // this takes the form of an associative array where the Email is the key for the real name
 $swiftMessage->setFrom(["breadbasketapp@gmail.com" => "Bread Basket"]);
 /**
  * attach the recipients to the message
  * notice this an array that can include or omit the the recipient's real name
开发者ID:brbrown59,项目名称:bread-basket,代码行数:31,代码来源:sign-up-controller.php

示例3: testGetValidOrganizationByOrgId

 /**
  * test inserting an organization and regrabbing it from mySQL
  */
 public function testGetValidOrganizationByOrgId()
 {
     //count the number of rows currently in the database
     $numRows = $this->getConnection()->getRowCount("organization");
     //create a new organization and insert into mySQL
     $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);
     $organization->insert($this->getPDO());
     //grab data from mySQL and enforce that the fields match
     $pdoOrganization = Organization::getOrganizationByOrgId($this->getPDO(), $organization->getOrgId());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("organization"));
     $this->assertSame($pdoOrganization->getOrgAddress1(), $this->VALID_ADDRESS1);
     $this->assertSame($pdoOrganization->getOrgAddress2(), $this->VALID_ADDRESS2);
     $this->assertSame($pdoOrganization->getOrgCity(), $this->VALID_CITY);
     $this->assertSame($pdoOrganization->getOrgDescription(), $this->VALID_DESCRIPTION);
     $this->assertSame($pdoOrganization->getOrgHours(), $this->VALID_HOURS);
     $this->assertSame($pdoOrganization->getOrgName(), $this->VALID_NAME);
     $this->assertSame($pdoOrganization->getOrgPhone(), $this->VALID_PHONE);
     $this->assertSame($pdoOrganization->getOrgState(), $this->VALID_STATE);
     $this->assertSame($pdoOrganization->getOrgType(), $this->VALID_TYPE);
     $this->assertSame($pdoOrganization->getOrgZip(), $this->VALID_ZIP);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:24,代码来源:organization-test.php

示例4: testValidPut

 /**
  * test putting a valid organization into the API
  */
 public function testValidPut()
 {
     //create a new organization, and insert into the database
     $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);
     $organization->insert($this->getPDO());
     //update the organization
     $organization->setOrgName($this->VALID_NAME_ALT);
     //send the info to update to the API
     $response = $this->guzzle->put('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/organization/' . $organization->getOrgId(), ['allow-redirects' => ['strict' => true], 'json' => $organization, 'headers' => ['X-XSRF-TOKEN' => $this->token]]);
     //ensure the response was sent, and the api returned a positive status
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $retrievedOrg = json_decode($body);
     $this->assertSame(200, $retrievedOrg->status);
     //pull the value from the DB, and make sure it was properly updated
     $neworg = Organization::getOrganizationByOrgId($this->getPDO(), $organization->getOrgId());
     $this->assertSame($neworg->getOrgName(), $this->VALID_NAME_ALT);
 }
开发者ID:brbrown59,项目名称:bread-basket,代码行数:21,代码来源:org-api-test.php


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