function setUp() { $this->api = new Phlickr_Api(TESTING_API_KEY, TESTING_API_SECRET, TESTING_API_TOKEN); $this->api->setEndpointUrl('http://example.com'); // inject the response xml into the cache... // ... first the login details (so it can figure out the user id) $this->api->addResponseToCache('flickr.auth.checkToken', $this->api->getParamsForRequest(), TESTING_RESP_OK_PREFIX . TESTING_XML_CHECKTOKEN . TESTING_RESP_SUFIX); // ... then the full description of the photo $this->api->addResponseToCache(Phlickr_Photo::getRequestMethodName(), Phlickr_Photo::getRequestMethodParams(TESTING_PHOTO_ID), TESTING_RESP_OK_PREFIX . TESTING_XML_PHOTO_LONG . TESTING_RESP_SUFIX); $this->photo = new Phlickr_AuthedPhoto($this->api, TESTING_PHOTO_ID); }
function testBuildImgUrl_OriginalSize() { // add the bare minimum response specifying the original size file type $this->api->addResponseToCache('flickr.photos.getSizes', Phlickr_Photo::getRequestMethodParams(TESTING_PHOTO_ID), TESTING_RESP_OK_PREFIX . <<<XML <sizes> <size label="Original" width="1733" height="1146" source="http://static.flickr.com/22/24778503_7263862414_o.jpg"/> </sizes> XML . TESTING_RESP_SUFIX); $result = $this->fromShortXml->buildImgUrl(Phlickr_Photo::SIZE_ORIGINAL); $this->assertEquals('http://static.flickr.com/12/2733_123456_o.jpg', $result); }