Пример #1
0
    test($b->_public == 0);
    test($b->_this == 0);
    test($b->_throw == 0);
    test($b->_use == 0);
    test($b->_var == 0);
    $p = $communicator->stringToProxy("test:tcp -p 10000");
    $c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") :
               eval("return and_functionPrxHelper::uncheckedCast(\$p);");
    $d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") :
               eval("return and_diePrxHelper::uncheckedCast(\$p);");
    $e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") :
               eval("return and_echoPrxHelper::uncheckedCast(\$p);");
    $e1 = new echoI();
    $f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") :
               eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);");
    $f1 = new enddeclareI();
    $g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();");
    $h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();");
    $i = $NS ? constant("_and\\_or") : constant("and_or");
    $j = $NS ? constant("_and\\_print") : constant("and_print");
    $j = $NS ? constant("_and\\_require_once") : constant("and_require_once");
    echo "ok\n";
}

$communicator = Ice_initialize(&$argv);
allTests($communicator);
$communicator->destroy();

exit();
?>
Пример #2
0
function allTests($communicator)
{
    $ref = "test:default -p 12010";
    $base = $communicator->stringToProxy($ref);
    $cl = $base->ice_checkedCast("::Test::MyClass");
    $derived = $cl->ice_checkedCast("::Test::MyDerivedClass");
    echo "testing twoway operations... ";
    flush();
    twoways($communicator, $cl);
    twoways($communicator, $derived);
    $derived->opDerived();
    echo "ok\n";
    return $cl;
}
$communicator = Ice_initialize($argv);
$myClass = allTests($communicator);
echo "testing server shutdown... ";
flush();
$myClass->shutdown();
try {
    $myClass->opVoid();
    test(false);
} catch (Exception $ex) {
    $le = $NS ? "Ice\\LocalException" : "Ice_LocalException";
    if (!$ex instanceof $le) {
        throw $ex;
    }
    echo "ok\n";
}
$communicator->destroy();
exit;
Пример #3
0
    }
    //
    // Get server's Slice checksums.
    //
    $d = $checksum->getSliceChecksums();
    //
    // Compare the checksums. For a type FooN whose name ends in an integer N,
    // we assume that the server's type does not change for N = 1, and does
    // change for N > 1.
    //
    foreach ($d as $i => $value) {
        $n = 0;
        preg_match("/\\d+/", $i, $matches);
        if ($matches) {
            $n = (int) $matches[0];
        }
        test(isset($Ice_sliceChecksums[$i]));
        if ($n <= 1) {
            test($Ice_sliceChecksums[$i] == $d[$i]);
        } else {
            test($Ice_sliceChecksums[$i] != $d[$i]);
        }
    }
    echo "ok\n";
    return $checksum;
}
$communicator = Ice_initialize($argv);
$checksum = allTests($communicator);
$checksum->shutdown();
$communicator->destroy();
exit;
Пример #4
0
        test($info->localAddress == $defaultHost);
    }
    test($info->rcvSize >= 1024);
    test($info->sndSize >= 2048);
    $ctx = $testIntf->getConnectionInfoAsContext();
    test($ctx["incoming"] == "true");
    test($ctx["adapterName"] == "TestAdapter");
    test($ctx["remoteAddress"] == $info->localAddress);
    test($ctx["localAddress"] == $info->remoteAddress);
    test($ctx["remotePort"] == $info->localPort);
    test($ctx["localPort"] == $info->remotePort);
    if ($base->ice_getConnection()->type() == "ws" || $base->ice_getConnection()->type() == "wss") {
        test($base->ice_getConnection()->type() == "ws" && $info instanceof $wsConnectionInfoClass || $base->ice_getConnection()->type() == "wss" && $info instanceof $wssConnectionInfoClass);
        test($info->headers["Upgrade"] == "websocket");
        test($info->headers["Connection"] == "Upgrade");
        test($info->headers["Sec-WebSocket-Protocol"] == "ice.zeroc.com");
        test(isset($info->headers["Sec-WebSocket-Accept"]));
        test($ctx["ws.Upgrade"] == "websocket");
        test($ctx["ws.Connection"] == "Upgrade");
        test($ctx["ws.Sec-WebSocket-Protocol"] == "ice.zeroc.com");
        test($ctx["ws.Sec-WebSocket-Version"] == "13");
        test(isset($ctx["ws.Sec-WebSocket-Key"]));
    }
    echo "ok\n";
    return $testIntf;
}
$communicator = Ice_initialize($argv);
$server = allTests($communicator);
$server->shutdown();
$communicator->destroy();
exit;
Пример #5
0
        test($ex->b == "test");
        test($ex->o->a == 53);
        test($ex->ss == "test");
        test($ex->o2 == $ex->o);
    }
    try {
        $initial->opRequiredException(Ice_Unset, Ice_Unset, Ice_Unset);
    } catch (Exception $ex) {
        test($ex->a == Ice_Unset);
        test($ex->b == Ice_Unset);
        test($ex->o == Ice_Unset);
        test($ex->ss != Ice_Unset);
        test($ex->o2 != Ice_Unset);
    }
    try {
        $initial->opRequiredException(30, "test", new $oocls(53));
    } catch (Exception $ex) {
        test($ex->a == 30);
        test($ex->b == "test");
        test($ex->o->a == 53);
        test($ex->ss == "test");
        test($ex->o2 == $ex->o);
    }
    echo "ok\n";
    return $initial;
}
$communicator = Ice_initialize($argv);
$initial = allTests($communicator);
$initial->shutdown();
$communicator->destroy();
exit;
Пример #6
0
}
function allTests()
{
    global $NS;
    echo "testing Slice predefined macros... ";
    flush();
    if ($NS) {
        $d = new Test\_Default();
        test($d->x == 10);
        test($d->y == 10);
        $nd = new Test\NoDefault();
        test($nd->x != 10);
        test($nd->y != 10);
        $c = new Test\PhpOnly();
        test($c->lang == "php");
        test($c->version == Ice\intVersion());
    } else {
        $d = new Test_Default();
        test($d->x == 10);
        test($d->y == 10);
        $nd = new Test_NoDefault();
        test($nd->x != 10);
        test($nd->y != 10);
        $c = new Test_PhpOnly();
        test($c->lang == "php");
        test($c->version == Ice_intVersion());
    }
    echo "ok\n";
}
allTests();
exit;
Пример #7
0
        test(false);
    } catch (Exception $ex) {
        $ule = $NS ? "Ice\\UnknownLocalException" : "Ice_UnknownLocalException";
        $one = $NS ? "Ice\\OperationNotExistException" : "Ice_OperationNotExistException";
        if (!$ex instanceof $ule && !$ex instanceof $one) {
            throw $ex;
        }
    }
    echo "ok\n";
    echo "catching unknown non-Ice exception... ";
    flush();
    try {
        $thrower->throwNonIceException();
        test(false);
    } catch (Exception $ex) {
        $ue = $NS ? "Ice\\UnknownException" : "Ice_UnknownException";
        if (!$ex instanceof $ue) {
            throw $ex;
        }
    }
    echo "ok\n";
    return $thrower;
}
$initData = $NS ? eval("return new Ice\\InitializationData;") : eval("return new Ice_InitializationData;");
$initData->properties = Ice_getProperties();
$initData->properties->setProperty("Ice.MessageSizeMax", "10");
$communicator = Ice_initialize($argv, $initData);
$thrower = allTests($communicator);
$thrower->shutdown();
$communicator->destroy();
exit;
};
//$testDifference();
function runTest($varName)
{
    echo "call made to: " . $varName . " test<br>";
    $varName = strtoupper(str_split($varName, 1)[0]) . substr($varName, 1);
    global ${"test" . $varName};
    if (is_callable(${"test" . $varName})) {
        ${"test" . $varName}();
    }
}
//runTest("difference");
//runTest("some");
//runTest("flatten");
function allTests($className)
{
    global $_;
    $_->each(get_class_methods($className), function ($varName) {
        runTest($varName);
    });
}
allTests(myUnderScore);
//echo ("This is the Testing Page");
?>





</body>