• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zend_Http_Client_Adapter_Test类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zend_Http_Client_Adapter_Test的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Http_Client_Adapter_Test类的具体用法?PHP Zend_Http_Client_Adapter_Test怎么用?PHP Zend_Http_Client_Adapter_Test使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: shouldUnshortenAGivenShortenedUrl

 /**
  * @test
  */
 public function shouldUnshortenAGivenShortenedUrl()
 {
     $adapter = new Zend_Http_Client_Adapter_Test();
     $client = new Zend_Http_Client('http://adapter.org', array('adapter' => $adapter));
     $adapter->setResponse("HTTP/1.1 302 Found" . "\r\n" . "Location: http://zendframework.com" . "\r\n");
     $this->_service = new Recordshelf_Service_Isgd($client);
     $this->assertEquals('http://zendframework.com', $this->_service->unshorten('http://is.gd/1T35Q'));
 }
开发者ID:raphaelstolt,项目名称:isgd-api-client,代码行数:11,代码来源:IsgdTest.php


示例2: testGetAdapterWithConfig

 public function testGetAdapterWithConfig()
 {
     $httptest = new Zend_Http_Client_Adapter_Test();
     // Nirvanix adapter
     $nirvanixConfig = new Zend_Config_Ini(realpath(dirname(__FILE__) . '/_files/config/nirvanix.ini'));
     $nirvanixConfig = $nirvanixConfig->toArray();
     $nirvanixConfig[Zend_Cloud_StorageService_Adapter_Nirvanix::HTTP_ADAPTER] = $httptest;
     $doc = new DOMDocument('1.0', 'utf-8');
     $root = $doc->createElement('Response');
     $responseCode = $doc->createElement('ResponseCode', 0);
     $sessionTok = $doc->createElement('SessionToken', '54592180-7060-4D4B-BC74-2566F4B2F943');
     $root->appendChild($responseCode);
     $root->appendChild($sessionTok);
     $doc->appendChild($root);
     $body = $doc->saveXML();
     $resp = new Zend_Http_Response(200, array('Date' => 0), $body);
     $httptest->setResponse($resp);
     $nirvanixAdapter = Zend_Cloud_StorageService_Factory::getAdapter($nirvanixConfig);
     $this->assertEquals('Zend_Cloud_StorageService_Adapter_Nirvanix', get_class($nirvanixAdapter));
     // S3 adapter
     $s3Config = new Zend_Config_Ini(realpath(dirname(__FILE__) . '/_files/config/s3.ini'));
     $s3Adapter = Zend_Cloud_StorageService_Factory::getAdapter($s3Config);
     $this->assertEquals('Zend_Cloud_StorageService_Adapter_S3', get_class($s3Adapter));
     // file system adapter
     $fileSystemConfig = new Zend_Config_Ini(realpath(dirname(__FILE__) . '/_files/config/filesystem.ini'));
     $fileSystemAdapter = Zend_Cloud_StorageService_Factory::getAdapter($fileSystemConfig);
     $this->assertEquals('Zend_Cloud_StorageService_Adapter_FileSystem', get_class($fileSystemAdapter));
     // Azure adapter
     $azureConfig = new Zend_Config_Ini(realpath(dirname(__FILE__) . '/_files/config/windowsazure.ini'));
     $azureConfig = $azureConfig->toArray();
     $azureContainer = $azureConfig[Zend_Cloud_StorageService_Adapter_WindowsAzure::CONTAINER];
     $azureConfig[Zend_Cloud_StorageService_Adapter_WindowsAzure::HTTP_ADAPTER] = $httptest;
     $q = "?";
     $doc = new DOMDocument('1.0', 'utf-8');
     $root = $doc->createElement('EnumerationResults');
     $acctName = $doc->createAttribute('AccountName');
     $acctName->value = 'http://myaccount.blob.core.windows.net';
     $root->appendChild($acctName);
     $maxResults = $doc->createElement('MaxResults', 1);
     $containers = $doc->createElement('Containers');
     $container = $doc->createElement('Container');
     $containerName = $doc->createElement('Name', $azureContainer);
     $container->appendChild($containerName);
     $containers->appendChild($container);
     $root->appendChild($maxResults);
     $root->appendChild($containers);
     $doc->appendChild($root);
     $body = $doc->saveXML();
     $resp = new Zend_Http_Response(200, array('x-ms-request-id' => 0), $body);
     $httptest->setResponse($resp);
     $azureAdapter = Zend_Cloud_StorageService_Factory::getAdapter($azureConfig);
     $this->assertEquals('Zend_Cloud_StorageService_Adapter_WindowsAzure', get_class($azureAdapter));
 }
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:53,代码来源:FactoryTest.php


示例3: setUp

 /**
  * Set up the test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->rackspace = new Zend_Service_Rackspace_Files('foo', 'bar');
     $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test();
     $this->rackspace->getHttpClient()->setAdapter($this->httpClientAdapterTest);
     // authentication (from a file)
     $this->httpClientAdapterTest->setResponse(self::loadResponse('../../_files/testAuthenticate'));
     $this->assertTrue($this->rackspace->authenticate(), 'Authentication failed');
     $this->metadata = array('foo' => 'bar', 'foo2' => 'bar2');
     $this->metadata2 = array('hello' => 'world');
     // load the HTTP response (from a file)
     $this->httpClientAdapterTest->setResponse($this->loadResponse($this->getName()));
 }
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:18,代码来源:OfflineTest.php


示例4: setUp

 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter(array(Zend_Cloud_Infrastructure_Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend_Cloud_Infrastructure_Adapter_Ec2', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_ACCESS_KEY => 'foo', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_SECRET_KEY => 'bar', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_REGION => 'us-east-1'));
     $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test();
     // load the HTTP response (from a file)
     $shortClassName = substr(__CLASS__, strlen('Zend_Cloud_Infrastructure_Adapter_'));
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         $this->httpClientAdapterTest->setResponse($this->loadResponse($filename));
     }
     $adapter = $this->infrastructure->getAdapter();
     $client = new Zend_Http_Client(null, array('adapter' => $this->httpClientAdapterTest));
     call_user_func(array($adapter, 'setHttpClient'), $client);
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:17,代码来源:Ec2Test.php


示例5: setUp

 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter(array(Zend_Cloud_Infrastructure_Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend_Cloud_Infrastructure_Adapter_Rackspace', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_USER => 'foo', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_KEY => 'bar', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_REGION => 'USA'));
     $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test();
     $this->infrastructure->getAdapter()->getHttpClient()->setAdapter($this->httpClientAdapterTest);
     // load the HTTP response (from a file)
     $shortClassName = 'RackspaceTest';
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         // authentication (from file)
         $content = dirname(__FILE__) . '/_files/' . $shortClassName . '_testAuthenticate.response';
         $this->httpClientAdapterTest->setResponse($this->loadResponse($content));
         $this->assertTrue($this->infrastructure->getAdapter()->authenticate(), 'Authentication failed');
         $this->httpClientAdapterTest->setResponse($this->loadResponse($filename));
     }
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:19,代码来源:RackspaceTest.php


示例6: getInfo

 /**
  * Private method that queries REST service and returns SimpleXML response set
  *
  * @param  string $service name of Audioscrobbler service file we're accessing
  * @param  string $params  parameters that we send to the service if needded
  * @throws Zend_Http_Client_Exception
  * @throws Zend_Service_Exception
  * @return SimpleXMLElement result set
  */
 private function getInfo($service, $params = null)
 {
     $service = (string) $service;
     $params = (string) $params;
     if ($params === '') {
         $this->_client->setUri("http://ws.audioscrobbler.com{$service}");
     } else {
         $this->_client->setUri("http://ws.audioscrobbler.com{$service}?{$params}");
     }
     if ($this->_testing) {
         /**
          * @see Zend_Http_Client_Adapter_Test
          */
         require_once 'Zend/Http/Client/Adapter/Test.php';
         $adapter = new Zend_Http_Client_Adapter_Test();
         $this->_client->setConfig(array('adapter' => $adapter));
         $adapter->setResponse($this->_testingResponse);
     }
     $request = $this->_client->request();
     $response = $request->getBody();
     if ($response == 'No such path') {
         throw new Zend_Http_Client_Exception('Could not find: ' . $this->_client->getUri());
     } else {
         if ($response == 'No user exists with this name.') {
             throw new Zend_Http_Client_Exception('No user exists with this name');
         } else {
             if ($request->isError()) {
                 throw new Zend_Http_Client_Exception('The web service ' . $this->_client->getUri() . ' returned the following status code: ' . $response->getStatus());
             }
         }
     }
     set_error_handler(array($this, '_errorHandler'));
     if (!($simpleXmlElementResponse = simplexml_load_string($response))) {
         restore_error_handler();
         /**
          * @see Zend_Service_Exception
          */
         require_once 'Zend/Service/Exception.php';
         $exception = new Zend_Service_Exception('Response failed to load with SimpleXML');
         $exception->error = $this->_error;
         $exception->response = $response;
         throw $exception;
     }
     restore_error_handler();
     return $simpleXmlElementResponse;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:55,代码来源:Audioscrobbler.php


示例7: testImportingUriWithEmptyResponseBodyTriggersException

 /**
  * @group ZF-11184
  */
 public function testImportingUriWithEmptyResponseBodyTriggersException()
 {
     $currClient = Zend_Feed_Reader::getHttpClient();
     $testAdapter = new Zend_Http_Client_Adapter_Test();
     $testAdapter->setResponse(new Zend_Http_Response(200, array(), ''));
     Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter)));
     $this->setExpectedException('Zend_Feed_Exception', 'Feed failed to load');
     $result = Zend_Feed_Reader::import('http://www.example.com');
 }
开发者ID:omusico,项目名称:logica,代码行数:12,代码来源:ReaderTest.php


示例8: testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath

 /**
  * @group ZF-8330
  */
 public function testGetsFeedLinksAndNormalisesRelativeUrlsOnUriWithPath()
 {
     try {
         $currClient = Zend_Feed_Reader::getHttpClient();
         $testAdapter = new Zend_Http_Client_Adapter_Test();
         $testAdapter->setResponse(new Zend_Http_Response(200, array(), '<!DOCTYPE html><html><head><link rel="alternate" type="application/rss+xml" href="../test.rss"><link rel="alternate" type="application/atom+xml" href="/test.atom"></head><body></body></html>'));
         Zend_Feed_Reader::setHttpClient(new Zend_Http_Client(null, array('adapter' => $testAdapter)));
         $links = Zend_Feed_Reader::findFeedLinks('http://foo/bar');
         Zend_Feed_Reader::setHttpClient($currClient);
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     $this->assertEquals('http://foo/test.rss', $links->rss);
     $this->assertEquals('http://foo/test.atom', $links->atom);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:18,代码来源:ReaderTest.php


示例9: testDownloadAttachmentShouldNotCallInsertFileWhen404

 public function testDownloadAttachmentShouldNotCallInsertFileWhen404()
 {
     global $filegallib;
     require_once 'lib/filegals/filegallib.php';
     $filegallib = $this->getMock('FileGalLib', array('insert_file'));
     $filegallib->expects($this->exactly(0))->method('insert_file');
     $adapter = new Zend_Http_Client_Adapter_Test();
     $adapter->setResponse("HTTP/1.1 404 NOT FOUND" . "\r\n" . "Content-type: image/jpg" . "\r\n" . "Content-length: 1034" . "\r\n" . "\r\n" . 'empty content');
     $client = new Zend_Http_Client();
     $client->setAdapter($adapter);
     $obj = $this->getMock('TikiImporter_Blog_Wordpress', array('getHttpClient', 'createFileGallery'));
     $obj->expects($this->once())->method('createFileGallery')->will($this->returnValue(1));
     $obj->expects($this->once())->method('getHttpClient')->will($this->returnValue($client));
     $obj->dom = new DOMDocument();
     $obj->dom->load(dirname(__FILE__) . '/fixtures/wordpress_attachments.xml');
     $this->expectOutputString("\n\nImporting attachments:\nUnable to download attachment tadv2.jpg. Error message was: 404 NOT FOUND\nUnable to download attachment 1881232-hostelaria-las-torres-0.jpg. Error message was: 404 NOT FOUND\nUnable to download attachment 1881259-caminhando-no-gelo-no-vale-do-sil-ncio-0.jpg. Error message was: 404 NOT FOUND\n0 attachments imported and 3 errors.\n");
     $obj->downloadAttachments();
     $this->assertEquals(array(), $obj->newFiles);
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:19,代码来源:TikiImporterBlogWordpressTest.php


示例10: testNewsshortActionFail

 public function testNewsshortActionFail()
 {
     $adapter = new Zend_Http_Client_Adapter_Test();
     $adapter->setNextRequestWillFail(true);
     Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $adapter)));
     $this->dispatch('/index/newsshort');
     $this->assertController('index');
     $this->assertAction('newsshort');
     $this->assertQuery('p.messagebox.warning');
 }
开发者ID:dmj,项目名称:uni-helmstedt.hab.de,代码行数:10,代码来源:IndexControllerTest.php


示例11: testCaptureCookiesNoEncodeZF1850

 /**
  * Test that when the encodecookies flag is set to FALSE, cookies captured
  * from a response by Zend_Http_CookieJar are not encoded
  *
  * @group ZF-1850
  */
 public function testCaptureCookiesNoEncodeZF1850()
 {
     $cookieName = "cookieWithSpecialChars";
     $cookieValue = "HID=XXXXXX&UN=XXXXXXX&UID=XXXXX";
     $adapter = new Zend_Http_Client_Adapter_Test();
     $adapter->setResponse("HTTP/1.0 200 OK\r\n" . "Content-type: text/plain\r\n" . "Content-length: 2\r\n" . "Connection: close\r\n" . "Set-Cookie: {$cookieName}={$cookieValue}; path=/\r\n" . "\r\n" . "OK");
     $this->_client->setUri('http://example.example/test');
     $this->_client->setConfig(array('adapter' => $adapter, 'encodecookies' => false));
     $this->_client->setCookieJar();
     // First request is expected to set the cookie
     $this->_client->request();
     // Next request should contain the cookie
     $this->_client->request();
     $request = $this->_client->getLastRequest();
     if (!preg_match("/^Cookie: {$cookieName}=([^;]+)/m", $request, $match)) {
         $this->fail("Could not find cookie in request");
     }
     $this->assertEquals($cookieValue, $match[1]);
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:25,代码来源:StaticTest.php


示例12: getInfo

 /**
  *
  * Private method that queries REST service and returns SimpleXML response set
  * @param string $service name of Audioscrobbler service file we're accessing
  * @param string $params parameters that we send to the service if needded
  * @return SimpleXML result set
  */
 private function getInfo($service, $params = NULL)
 {
     $service = (string) $service;
     $params = (string) $params;
     try {
         if ($params == "") {
             $this->_client->setUri("http://ws.audioscrobbler.com{$service}");
         } else {
             $this->_client->setUri("http://ws.audioscrobbler.com{$service}?{$params}");
         }
         if ($this->testing == TRUE) {
             $adapter = new Zend_Http_Client_Adapter_Test();
             $this->_client->setConfig(array('adapter' => $adapter));
             $adapter->setResponse($this->testing_response);
         }
         $request = $this->_client->request();
         $response = $request->getBody();
         if ($response == 'No such path') {
             throw new Zend_Http_Client_Exception('Could not find: ' . $this->_client->getUri());
         } else {
             if ($response == 'No user exists with this name.') {
                 throw new Zend_Http_Client_Exception('No user exists with this name');
             } else {
                 if ($request->isError()) {
                     throw new Zend_Http_Client_Exception('The web service ' . $this->_client->getUri() . ' returned the following status code: ' . $response->getStatus());
                 } else {
                     return simplexml_load_string($response);
                 }
             }
         }
     } catch (Zend_Http_Client_Exception $e) {
         throw $e;
     }
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:41,代码来源:Audioscrobbler.php


示例13: testGetAuthSubTokenInfoCatchesHttpClientException

 /**
  * @expectedException Zend_Gdata_App_HttpException
  */
 public function testGetAuthSubTokenInfoCatchesHttpClientException()
 {
     $adapter = new Zend_Http_Client_Adapter_Test();
     $adapter->setNextRequestWillFail(true);
     $client = new Zend_Gdata_HttpClient();
     $client->setUri('http://example.com/AuthSub');
     $client->setAdapter($adapter);
     $revoked = Zend_Gdata_AuthSub::getAuthSubTokenInfo($this->token, $client);
 }
开发者ID:omusico,项目名称:logica,代码行数:12,代码来源:AuthSubTest.php


示例14: testTagSearchBasic

 /**
  * Basic testing to ensure that tagSearch() works as expected
  *
  * @return void
  */
 public function testTagSearchBasic()
 {
     $this->_flickr->getRestClient()->getHttpClient()->setAdapter($this->_httpClientAdapterTest);
     $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__));
     $options = array('per_page' => 10, 'page' => 1, 'tag_mode' => 'or', 'extras' => 'license, date_upload, date_taken, owner_name, icon_server');
     $resultSet = $this->_flickr->tagSearch('php', $options);
     $this->assertEquals(4285, $resultSet->totalResultsAvailable);
     $this->assertEquals(10, $resultSet->totalResults());
     $this->assertEquals(10, $resultSet->totalResultsReturned);
     $this->assertEquals(1, $resultSet->firstResultPosition);
     $this->assertEquals(0, $resultSet->key());
     try {
         $resultSet->seek(-1);
     } catch (OutOfBoundsException $e) {
         $this->assertContains('Illegal index', $e->getMessage());
     }
     $resultSet->seek(9);
     try {
         $resultSet->seek(10);
     } catch (OutOfBoundsException $e) {
         $this->assertContains('Illegal index', $e->getMessage());
     }
     $resultSet->rewind();
     $resultSetIds = array('428222530', '427883929', '427884403', '427887192', '427883923', '427884394', '427883930', '427884398', '427883924', '427884401');
     $this->assertTrue($resultSet->valid());
     foreach ($resultSetIds as $resultSetId) {
         $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__ . "-result_{$resultSetId}"));
         $result = $resultSet->current();
         $this->assertTrue($result instanceof Zend_Service_Flickr_Result);
         $resultSet->next();
     }
     $this->assertFalse($resultSet->valid());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:38,代码来源:FlickrTest.php


示例15: testGravatarExistsWithCache

 /**
  * @covers Robo47_Service_Gravatar::gravatarExists
  * @covers Robo47_Service_Gravatar::_getCacheId
  * @dataProvider gravatarExistsProvider
  */
 public function testGravatarExistsWithCache()
 {
     $cache = Zend_Cache::factory('Core', new Robo47_Cache_Backend_Array(), array('automatic_cleaning_factor' => 0), array('automatic_cleaning_factor' => 0));
     $options = array('cachePrefix' => 'foo_', 'cache' => $cache);
     $service = new Robo47_Service_Gravatar($options);
     // do first request
     $this->_adapter->setResponse(new Zend_Http_Response(404, array()));
     $this->assertSame(false, $service->gravatarExists('[email protected]'));
     $cacheEntry = $cache->load($service->getCacheId('[email protected]'));
     $this->assertEquals('false', $cacheEntry, 'wrong value in cache');
     // assert cache is used and no request is made
     $this->_adapter->setResponse(new Zend_Http_Response(200, array()));
     $this->assertSame(false, $service->gravatarExists('[email protected]'));
     $cacheEntry = $cache->load($service->getCacheId('[email protected]'));
     $this->assertEquals('false', $cacheEntry, 'wrong value in cache');
     // ignore cache for checking
     $this->_adapter->setResponse(new Zend_Http_Response(200, array()));
     $this->assertSame(true, $service->gravatarExists('[email protected]', false));
     $cacheEntry = $cache->load($service->getCacheId('[email protected]'));
     $this->assertEquals('true', $cacheEntry, 'wrong value in cache');
     // use cache for checking
     $this->_adapter->setResponse(new Zend_Http_Response(404, array()));
     $this->assertSame(true, $service->gravatarExists('[email protected]'));
     $cacheEntry = $cache->load($service->getCacheId('[email protected]'));
     $this->assertEquals('true', $cacheEntry, 'wrong value in cache');
     // ignore cache again for checking
     $this->_adapter->setResponse(new Zend_Http_Response(404, array()));
     $this->assertSame(false, $service->gravatarExists('[email protected]', false));
     $cacheEntry = $cache->load($service->getCacheId('[email protected]'));
     $this->assertEquals('false', $cacheEntry, 'wrong value in cache');
 }
开发者ID:robo47,项目名称:robo47-components,代码行数:36,代码来源:GravatarTest.php


示例16: testAuthenticateError

 /**
  * Test the authentication error (401 Unauthorized - Bad username or password)
  *
  * @return void
  */
 public function testAuthenticateError()
 {
     $this->_files->getHttpClient()->setAdapter($this->_httpClientAdapterTest);
     $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__));
     $this->assertFalse($this->_files->authenticate());
     $this->assertFalse($this->_files->isSuccessful());
     $this->assertEquals($this->_files->getErrorCode(), '401');
     $this->assertEquals($this->_files->getErrorMsg(), 'Bad username or password');
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:14,代码来源:OfflineTest.php


示例17: _importInvalid

 /**
  * Import an invalid feed
  */
 protected function _importInvalid($filename)
 {
     $response = new Zend_Http_Response(200, array(), file_get_contents("{$this->_feedDir}/{$filename}"));
     $this->_adapter->setResponse($response);
     try {
         $feed = Zend_Feed::import('http://localhost');
     } catch (Exception $e) {
     }
     $this->assertTrue($e instanceof Zend_Feed_Exception, 'Expected Zend_Feed_Exception to be thrown');
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:ImportTest.php


示例18: write

 public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
 {
     $request = new Test_Zend_Gdata_MockHttpClient_Request();
     $request->method = $method;
     $request->uri = $uri;
     $request->http_ver = $http_ver;
     $request->headers = $headers;
     $request->body = $body;
     array_push($this->_requests, $request);
     return parent::write($method, $uri, $http_ver, $headers, $body);
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:MockHttpClient.php


示例19: testUserSearchExceptionEmailInvalid

 /**
  * Ensures that userSearch() throws an exception when an invalid e-mail address is given
  *
  * @return void
  */
 public function testUserSearchExceptionEmailInvalid()
 {
     $this->_flickr->getRestClient()->getHttpClient()->setAdapter($this->_httpClientAdapterTest);
     $this->_httpClientAdapterTest->setResponse($this->_loadResponse(__FUNCTION__));
     try {
         $this->_flickr->userSearch('[email protected]');
         $this->fail('Expected Zend_Service_Exception not thrown');
     } catch (Zend_Service_Exception $e) {
         $this->assertContains('User not found', $e->getMessage());
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:16,代码来源:OfflineTest.php


示例20: _importInvalid

 /**
  * Imports an invalid feed
  */
 protected function _importInvalid($filename)
 {
     $response = new Zend_Http_Response(200, array(), file_get_contents("{$this->_feedDir}/{$filename}"));
     $this->_adapter->setResponse($response);
     try {
         $feed = Zend_Feed::import('http://localhost');
         $this->fail('Expected Zend_Feed_Exception not thrown');
     } catch (Zend_Feed_Exception $e) {
         $this->assertType('Zend_Feed_Exception', $e);
     }
 }
开发者ID:travisj,项目名称:zf,代码行数:14,代码来源:ImportTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Http_Cookie类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Http_Client_Adapter_Socket类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap