本文整理汇总了PHP中Organization::setOrgName方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::setOrgName方法的具体用法?PHP Organization::setOrgName怎么用?PHP Organization::setOrgName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::setOrgName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUpdateValidOrganization
/**
* test inserting an organization, editing it, then updating it
*/
public function testUpdateValidOrganization()
{
//get the count of the number of rows 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());
//edit the organization and update it in mySQL
$organization->setOrgName($this->VALID_NAME_ALT);
$organization->update($this->getPDO());
//grab data from SQL and ensure it matches
$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_ALT);
$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);
}
示例2: 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);
}