コード例 #1
0
ファイル: AuthedPhoto.php プロジェクト: seeminglee/smldata
 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);
 }
コード例 #2
0
ファイル: Photo.php プロジェクト: ricardobar/WSClubeletro
    function testGetSizes_LargeJpg()
    {
        // inject the responses into the cache...
        // ...full info
        $this->api->addResponseToCache(Phlickr_Photo::getRequestMethodName(), Phlickr_Photo::getRequestMethodParams(24778503), TESTING_RESP_OK_PREFIX . <<<XML
\t<photo id="24778503" secret="7263862414" server="22"/>
XML
 . TESTING_RESP_SUFIX);
        // ...then size info
        $this->api->addResponseToCache('flickr.photos.getSizes', Phlickr_Photo::getRequestMethodParams(24778503), TESTING_RESP_OK_PREFIX . <<<XML
<sizes>
    <size label="Square" width="75" height="75"
        source="http://photos22.flickr.com/24778503_7263862414_s.jpg" />
    <size label="Thumbnail" width="100" height="66"
        source="http://photos22.flickr.com/24778503_7263862414_t.jpg" />
    <size label="Small" width="240" height="159"
        source="http://photos22.flickr.com/24778503_7263862414_m.jpg" />
    <size label="Medium" width="500" height="331"
        source="http://photos22.flickr.com/24778503_7263862414.jpg" />
    <size label="Large" width="1024" height="677"
        source="http://photos22.flickr.com/24778503_7263862414_b.jpg" />
    <size label="Original" width="1733" height="1146"
        source="http://photos22.flickr.com/24778503_7263862414_o.jpg" />
</sizes>
XML
 . TESTING_RESP_SUFIX);
        $photo = new Phlickr_Photo($this->api, 24778503);
        $result = $photo->getSizes();
        $this->assertType('array', $result);
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_75PX, $result), '75 pixel square size was not included');
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_100PX, $result), '100 pixel thumbnail size was not included');
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_240PX, $result), '240 pixel small size was not included');
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_500PX, $result), '500 pixel medium size was not included');
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_1024PX, $result), '1024 pixel large size was not included');
        $this->assertTrue(array_key_exists(Phlickr_Photo::SIZE_ORIGINAL, $result), 'original size was not included');
        $this->assertEquals(array(75, 75, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_75PX]);
        $this->assertEquals(array(100, 66, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_100PX]);
        $this->assertEquals(array(240, 159, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_240PX]);
        $this->assertEquals(array(500, 331, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_500PX]);
        $this->assertEquals(array(1024, 677, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_1024PX]);
        $this->assertEquals(array(1733, 1146, 'type' => 'jpg'), $result[Phlickr_Photo::SIZE_ORIGINAL]);
    }