/** * Test setter/getter method for tokens. * @covers \BogCon\YahooMessengerApi\Client::setTokens * @covers \BogCon\YahooMessengerApi\Client::getTokens * @covers \BogCon\YahooMessengerApi\Client::hasAccessToken * @covers \BogCon\YahooMessengerApi\Client::hasRequestToken */ public function testSetGetHasTokens() { $arrTokens = array('request' => 'someTestRequestToken', 'access' => array('oauth_token' => 'sometestOAuthToken', 'oauth_token_secret' => 'someTestOAuthTokenSecret', 'oauth_expires_in' => '3600', 'oauth_session_handle' => 'someTestOAuthSessionHandle', 'oauth_authorization_expires_in' => '770477963', 'xoauth_yahoo_guid' => 'someTestXOAuthYahooGuid')); $objYM = new Client('das1sdas', 'dasda123sdas', 'appKey', 'appSecret'); $this->assertSame(array(), $objYM->getTokens()); $objYM->setTokens($arrTokens); $this->assertSame($arrTokens, $objYM->getTokens()); $this->assertTrue($objYM->hasAccessToken()); $this->assertTrue($objYM->hasRequestToken()); $objYM->setTokens(array()); $this->assertFalse($objYM->hasAccessToken()); $this->assertFalse($objYM->hasRequestToken()); }
} catch (Exception $objEx) { $arrReturnValue['response'] = 'Could not get user avatar.'; Logger::log($objEx->getMessage()); } } } break; /* GET NOTIFICATIONS */ /* GET NOTIFICATIONS */ case 'get_notifications': if (!checkLocalLogin()) { $arrReturnValue['response'] = 'You must be logged in order to retrieve notifications.'; } else { try { $objYM = new Client($_SESSION['username'], $_SESSION['pwd'], APP_CONSUMER_KEY, APP_CONSUMER_SECRET); $objYM->setTokens($_SESSION['ym_tokens']); $objYM->setSession($_SESSION['ym_session']); $notifications = $objYM->fetchNotifications($_SESSION['ym_notifications_seq']); Logger::log(var_export($notifications, 1)); $arrAjaxResponse = array(); foreach ($notifications['responses'] as $notificationsResponse) { foreach ($notificationsResponse as $notificationType => $notif) { switch ($notificationType) { case 'logOff': $arrAjaxResponse[] = array('type' => $notificationType, 'info' => array('buddy' => htmlspecialchars($notif['buddy']))); break; case 'buddyInfo': foreach ($notif['contact'] as $notifContact) { $info = array('buddy' => htmlspecialchars($notifContact['sender']), 'network' => isset($notifContact['network']) ? $notifContact['network'] : 'yahoo', 'presenceMessage' => '', 'presenceState' => ''); if (isset($notifContact['customDNDStatus'])) { if (0 == $notifContact['customDNDStatus'] && 99 == $notifContact['presenceState']) {