コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
ファイル: ajax.php プロジェクト: realreef/webym
                                case 'sysMsg':
                                case 'disconnect':
                                default:
                                    // not yet supported
                            }
                        }
                    }
                    if (count($notifications['responses'])) {
                        $arrLastNotification = end($notifications['responses']);
                        $arrLastNotification = end($arrLastNotification);
                        $_SESSION['ym_notifications_seq'] = $arrLastNotification['sequence'] + 1;
                    }
                    $arrReturnValue['status'] = 'success';
                    $arrReturnValue['response'] = $arrAjaxResponse;
                    /* check if token was renewed during last call */
                    if ($objYM->isTokenRenewed()) {
                        $_SESSION['ym_tokens'] = $objYM->getTokens();
                    }
                } catch (Exception $objEx) {
                    $arrReturnValue['response'] = 'Could not get user notifications.';
                    Logger::log($objEx->getMessage());
                }
            }
            break;
        default:
            $arrReturnValue['response'] = 'Unknown ajax action.';
    }
}
ob_end_clean();
header('Content-Type: application/json;charset=utf-8');
echo json_encode($arrReturnValue);