コード例 #1
0
 /**
  * Test setter/getter method for renewed token flag.
  * @covers \BogCon\YahooMessengerApi\Client::setTokenRenewed
  * @covers \BogCon\YahooMessengerApi\Client::isTokenRenewed
  */
 public function testSetIsTokenRenewed()
 {
     $objYM = new Client('vxc123ads', 'das_+DAS', 'appKey', 'appSecret');
     $this->assertFalse($objYM->isTokenRenewed());
     $objYM->setTokenRenewed(true);
     $this->assertTrue($objYM->isTokenRenewed());
     $objYM->setTokenRenewed(false);
     $this->assertFalse(false, $objYM->isTokenRenewed());
     $objYM->setTokenRenewed(0);
     $this->assertFalse($objYM->isTokenRenewed());
     $objYM->setTokenRenewed('trueeee');
     $this->assertTrue($objYM->isTokenRenewed());
 }
コード例 #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);