Пример #1
0
function interop_main($args, $stub = false)
{
    if (!$stub) {
        $stub = _makeStub($args);
    }
    $test_case = $args['test_case'];
    echo "Running test case {$test_case}\n";
    switch ($test_case) {
        case 'empty_unary':
            emptyUnary($stub);
            break;
        case 'large_unary':
            largeUnary($stub);
            break;
        case 'client_streaming':
            clientStreaming($stub);
            break;
        case 'server_streaming':
            serverStreaming($stub);
            break;
        case 'ping_pong':
            pingPong($stub);
            break;
        case 'empty_stream':
            emptyStream($stub);
            break;
        case 'cancel_after_begin':
            cancelAfterBegin($stub);
            break;
        case 'cancel_after_first_response':
            cancelAfterFirstResponse($stub);
            break;
        case 'timeout_on_sleeping_server':
            timeoutOnSleepingServer($stub);
            break;
        case 'custom_metadata':
            customMetadata($stub);
            break;
        case 'status_code_and_message':
            statusCodeAndMessage($stub);
            break;
        case 'unimplemented_method':
            unimplementedMethod($stub);
            break;
        case 'service_account_creds':
            serviceAccountCreds($stub, $args);
            break;
        case 'compute_engine_creds':
            computeEngineCreds($stub, $args);
            break;
        case 'jwt_token_creds':
            jwtTokenCreds($stub, $args);
            break;
        case 'oauth2_auth_token':
            oauth2AuthToken($stub, $args);
            break;
        case 'per_rpc_creds':
            perRpcCreds($stub, $args);
            break;
        default:
            echo "Unsupported test case {$test_case}\n";
            exit(1);
    }
    return $stub;
}
Пример #2
0
echo "Running test case {$test_case}\n";
switch ($test_case) {
    case 'empty_unary':
        emptyUnary($stub);
        break;
    case 'large_unary':
        largeUnary($stub);
        break;
    case 'client_streaming':
        clientStreaming($stub);
        break;
    case 'server_streaming':
        serverStreaming($stub);
        break;
    case 'ping_pong':
        pingPong($stub);
        break;
    case 'empty_stream':
        emptyStream($stub);
        break;
    case 'cancel_after_begin':
        cancelAfterBegin($stub);
        break;
    case 'cancel_after_first_response':
        cancelAfterFirstResponse($stub);
        break;
    case 'timeout_on_sleeping_server':
        timeoutOnSleepingServer($stub);
        break;
    case 'service_account_creds':
        serviceAccountCreds($stub, $args);
Пример #3
0
            array_push($pingpong_array, "ping");
        } elseif ($mod5) {
            array_push($pingpong_array, "pong");
        } else {
            array_push($pingpong_array, $i);
        }
    }
    return $pingpong_array;
}
?>
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
    <title>PHP Ping Pong TEST</title>
</head>
<body>
    <div class="container">
        <h1>PHP Ping Pong TEST</h1>
        
        <?php 
$test_array = pingPong($pingpong_number);
# var_dump($test_array);
foreach ($test_array as $element) {
    echo "{$element}<br />";
}
?>
        
    </div>
</body>
</html>