當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Listing::getListingId方法代碼示例

本文整理匯總了PHP中Listing::getListingId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Listing::getListingId方法的具體用法?PHP Listing::getListingId怎麽用?PHP Listing::getListingId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Listing的用法示例。


在下文中一共展示了Listing::getListingId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetValidListingByListingId

 /**
  * test inserting a listing and regrabbing it from mySQL
  */
 public function testGetValidListingByListingId()
 {
     //get the count of the number of rows in the database
     $numRows = $this->getConnection()->getRowCount("listing");
     //create a new listing and insert into mySQL
     $listing = new Listing(null, $this->organization->getOrgId(), $this->VALID_CLAIMEDBY, $this->VALID_LISTINGCLOSED, $this->VALID_COST, $this->VALID_MEMO, $this->VALID_PARENT_ID, $this->valid_datetime, $this->listingType->getlistingTypeId());
     $listing->insert($this->getPDO());
     //grab data from SQL and ensure it matches
     $pdoListing = Listing::getListingByListingId($this->getPDO(), $listing->getListingId());
     $this->assertSame($numRows + 1, $this->getConnection()->getRowCount("listing"));
     $this->assertSame($pdoListing->getOrgId(), $this->organization->getOrgId());
     $this->assertSame($pdoListing->getListingClaimedBy(), $this->VALID_CLAIMEDBY);
     $this->assertSame($pdoListing->getListingClosed(), $this->VALID_LISTINGCLOSED);
     $this->assertSame($pdoListing->getListingCost(), $this->VALID_COST);
     $this->assertSame($pdoListing->getListingMemo(), $this->VALID_MEMO);
     $this->assertSame($pdoListing->getListingParentId(), $this->VALID_PARENT_ID);
     //Changed to assertEquals because this is an object and assertSame checks an object position in memory
     $this->assertEquals($pdoListing->getListingPostTime(), $this->valid_datetime);
     $this->assertSame($pdoListing->getListingTypeId(), $this->listingType->getlistingTypeId());
 }
開發者ID:brbrown59,項目名稱:bread-basket,代碼行數:23,代碼來源:listing-test.php

示例2: testValidDelete

 /**
  * test deleting a valid listing in the database
  * */
 public function testValidDelete()
 {
     //create a new listing, and insert it
     $listing = new Listing(null, $this->organization->getOrgId(), $this->VALID_CLAIMEDBY, $this->VALID_LISTINGCLOSED, $this->VALID_COST, $this->VALID_MEMO, $this->VALID_PARENT_ID, $this->valid_datetime, $this->listingType->getListingTypeId());
     $listing->insert($this->getPDO());
     //perform the actual delete
     $response = $this->guzzle->delete('https://bootcamp-coders.cnm.edu/~bbrown52/bread-basket/public_html/php/api/listing/' . $listing->getListingId(), ['headers' => ['X-XSRF-TOKEN' => $this->token]]);
     //grab the data from guzzle and enforce that the status codes are correct
     $this->assertSame($response->getStatusCode(), 200);
     $body = $response->getBody();
     $retrievedListing = json_decode($body);
     $this->assertSame(200, $retrievedListing->status);
     //try retrieving entry from database and ensure it was deleted
     $deletedListing = Listing::getListingByListingId($this->getPDO(), $listing->getOrgId());
     $this->assertNull($deletedListing);
 }
開發者ID:brbrown59,項目名稱:bread-basket,代碼行數:19,代碼來源:listing-api-test.php


注:本文中的Listing::getListingId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。