/** * Constructor * * The PhotosetList requires a User Id. If $userId is null the class will * try to use the $api->getUserId(). * * @param object Phlickr_API $api * @param string $userId User Id. If this isn't provided, the API's User * Id will be used instead. * @throws Phlickr_Exception */ function __construct(Phlickr_Api $api, $userId = null) { if (isset($userId)) { $this->_userId = $userId; } else { $this->_userId = $api->getUserId(); } if (is_null($this->_userId)) { throw new Phlickr_Exception('The photoset needs a User Id.'); } parent::__construct($api->createRequest(self::getRequestMethodName(), self::getRequestMethodParams($this->_userId)), self::XML_RESPONSE_ELEMENT, self::XML_RESPONSE_LIST_ELEMENT); }
function testGetUserId_WithAuth() { $api = new Phlickr_Api(TESTING_API_KEY, TESTING_API_SECRET, TESTING_API_TOKEN); // ... first the login details (so it can figure out the user id) $api->addResponseToCache('flickr.auth.checkToken', $this->api->getParamsForRequest(), TESTING_RESP_OK_PREFIX . TESTING_XML_CHECKTOKEN . TESTING_RESP_SUFIX); $this->assertEquals(TESTING_USER_ID, $api->getUserId()); }
/** * * @return string */ public function get_user_id() { return $this->_api->getUserId(); }