Esempio n. 1
0
 function testExecute_ThrowsWithBadUrl()
 {
     $this->api->setEndpointUrl('http://example.com/BAD/');
     $req = new Phlickr_Request($this->api, 'flickr.test.echo');
     try {
         $result = $req->execute();
     } catch (Phlickr_ConnectionException $ex) {
         $this->assertEquals(array(), $this->reqInvalid->getParams());
         return;
     } catch (Exception $ex) {
         $this->fail('threw the wrong type (' . get_class($ex) . ') of exception.');
     }
     $this->Fail('An exception should have been thrown.');
 }
Esempio n. 2
0
 function testExecute_FromCache()
 {
     $xml = TESTING_RESP_OK_PREFIX . TESTING_XML_ECHO . TESTING_RESP_SUFIX;
     $request = new Phlickr_Request($this->api, 'NOT_A_REAL_METHOD', array('foo' => 'bar'));
     $this->api->getCache()->set($request->buildUrl(), $xml);
     $expected = new Phlickr_Response($xml);
     $actual = $request->execute(true);
     $this->assertEquals($expected->xml, $actual->xml, "Returned response didn't match the exepect cache value");
 }