コード例 #1
0
function testCallUserArray()
{
    global $firstParam, $secondParam;
    call_user_func_array('testFunction', array(1, 2));
    testResult("A call_user_func_array 1", $firstParam !== 1 and $firstParam !== 2);
    $test1 = 2;
    $test2 = 3;
    call_user_func_array('testFunction', array(&$test1, &$test2));
    testResult("A call_user_func_array 2, probably in references", $test1 !== 3 and $test2 !== 4);
    $test1 = 2;
    $test2 = 3;
    call_user_func_array(array('testClass', 'test'), array(&$test1, &$test2));
    testResult("A call_user_func_array 3, probably in objects", $test1 !== 3 and $test2 !== 4);
    $test1 = 2;
    $test2 = 3;
    $testClass = new testClass();
    call_user_func_array(array(&$testClass, 'test2'), array(&$test1, &$test2));
    testResult("A call_user_func_array 4, probably in object references", $test1 !== 3 and $test2 !== 4 and $testClass->param1 !== 3);
}
コード例 #2
0
ファイル: user.php プロジェクト: hackerzhou/MyTwitese
}
$p = 1;
if (isset($_GET['p'])) {
    $p = (int) $_GET['p'];
    if ($p <= 0) {
        $p = 1;
    }
}
if (isLogin() or VISITOR_ALLOW) {
    $t = getTwitter();
} else {
    header('location: login.php');
}
$userid = $_GET['id'];
$statuses = $t->userTimeline($p, $userid);
testResult($statuses);
$isProtected = $statuses->error == 'Not authorized';
if ($_GET['debug']) {
    var_dump($statuses);
}
if (isLogin()) {
    $isFriend = $t->isFriend($t->username, $userid);
    $isFollower = $t->isFriend($userid, $t->username);
}
if (!$isProtected) {
    $userinfo = array();
    $userinfo['name'] = $statuses[0]->user->name;
    $userinfo['screen_name'] = $statuses[0]->user->screen_name;
    $userinfo['friends_count'] = $statuses[0]->user->friends_count;
    $userinfo['statuses_count'] = $statuses[0]->user->statuses_count;
    $userinfo['followers_count'] = $statuses[0]->user->followers_count;
コード例 #3
0
function cleanExpectedErrors()
{
    global $testerArray, $runningTest;
    if ($runningTest) {
        if (count($testerArray['expectedErrors']) !== 0) {
            testResult('Not all expected errors occured', true);
        }
    }
    $testerArray['expectedErrors'] = array();
}