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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 /**
  * 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;
 }