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


PHP EntityBody::fromString方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->mockRequest = new \Guzzle\Plugin\Mock\MockPlugin();
     $body = \Guzzle\Http\EntityBody::fromString($this->responseBodyString);
     $this->mockRequest->addResponse(new Guzzle\Http\Message\Response(200, $this->responseHeaders, $body));
     $this->client = $this->getClientInstance();
     $this->client->addClientSubscriber($this->mockRequest);
 }
开发者ID:digitaldevelopers,项目名称:merchant-esolutions-php,代码行数:8,代码来源:TestAbstract.php

示例2: setUp

 public function setUp()
 {
     $httpClient = $this->getMockBuilder('\\Guzzle\\Http\\Client')->getMock();
     $wdavClient = $this->getMockBuilder('\\Grale\\WebDav\\WebDavClient')->getMock();
     $wdavClient->expects($this->any())->method('getHttpClient')->will($this->returnValue($httpClient));
     $stream = EntityBody::fromString('Hello World!');
     $wdavClient->expects($this->any())->method('getStream')->will($this->returnValue($stream));
     $propfind = MultiStatus::parse($wdavClient, file_get_contents(__DIR__ . '/../../fixtures/streamwrapper.opendir.xml'));
     $wdavClient->expects($this->any())->method('setThrowExceptions')->will($this->returnValue($this->client));
     $wdavClient->expects($this->any())->method('propfind')->will($this->returnValue($propfind));
     $this->client = $wdavClient;
     StreamWrapper::register(null, $this->client);
 }
开发者ID:samizdam,项目名称:WebDAV,代码行数:13,代码来源:StreamWrapperTest.php

示例3: openAppendMode

 /**
  * Initialize the stream wrapper for an append stream.
  *
  * @param Url $url URL of the resource to be opened
  * @return bool Returns true on success or false on failure
  */
 protected function openAppendMode($url)
 {
     try {
         $contents = self::$client->get($url);
         $this->stream = EntityBody::fromString($contents);
         $this->stream->seek(0, SEEK_END);
     } catch (NoSuchResourceException $exception) {
         // The resource does not exist, so use a simple write stream
         return $this->openWriteOnly($url);
     }
     return true;
 }
开发者ID:samizdam,项目名称:WebDAV,代码行数:18,代码来源:StreamWrapper.php


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