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


PHP Response::expects方法代碼示例

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


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

示例1: testBind01

 public function testBind01()
 {
     $expectedJSON = file_get_contents(dirname(__DIR__) . '/../../Resources/json/client_aftership_couriers_response_handler_01.json');
     $this->response->expects($this->once())->method('getStatusCode')->will($this->returnValue(200));
     $this->response->expects($this->once())->method('getContent')->will($this->returnValue($expectedJSON));
     $this->responseHandler->bind($this->response, $this->collection);
     $this->assertEquals(26, $this->collection->count());
     $courier0 = $this->collection[0];
     $this->assertEquals('USPS', $courier0->getName());
     $this->assertEquals('United States Postal Service', $courier0->getOtherName());
     $this->assertEquals('+1 800-275-8777', $courier0->getPhone());
     $this->assertEquals(['USA'], $courier0->getServiceCountries());
     $this->assertEquals('usps', $courier0->getSlug());
     $this->assertEquals(['en'], $courier0->getSupportLanguages());
     $this->assertNotNull($courier0->getUpdatedAt());
     $this->assertEquals("https://www.usps.com", $courier0->getUrl());
     $courier13 = $this->collection[13];
     $this->assertEquals('Hong Kong Post', $courier13->getName());
     $this->assertEquals('香港郵政', $courier13->getOtherName());
     $this->assertEquals('+852 2921 2222', $courier13->getPhone());
     $this->assertEquals(['HKG'], $courier13->getServiceCountries());
     $this->assertEquals('hong-kong-post', $courier13->getSlug());
     $this->assertEquals(['en'], $courier13->getSupportLanguages());
     $this->assertNotNull($courier13->getUpdatedAt());
     $this->assertEquals("http://hongkongpost.com", $courier13->getUrl());
 }
開發者ID:antimattr,項目名稱:shipment-tracking,代碼行數:26,代碼來源:CouriersAPIResponseHandlerTest.php


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