Exemple #1
0
function main()
{
    pure_function_2(1, 2);
    fb_setprofile('profiler');
    pure_function_2(3, 4);
    srand(0xdeadbeef);
    try {
        test_exception();
    } catch (Exception $e) {
        //do nothing.
    }
    foreach (gen() as $x) {
    }
    fb_setprofile(null);
    pure_function_2(5, 6);
}
assert_equals($stringStruct->a, "foobar");
/**
 * Integration Test
 * This config file is from configerator/materialize_configs/ffuuu
 * It should not product any exceptions
 */
try {
    $config = new Config(array());
    $config->readFromJson(file_get_contents($HERE . '/config.json'));
} catch (Exception $e) {
    print_r($e);
    fail("Fail intregation test!");
}
/**
 * Test invalid JSON string
 */
$invalidJson1 = "{ 'a': 'baz' }";
test_exception($stringStruct, $invalidJson1);
$invalidJson2 = '{ a : "baz" }';
test_exception($stringStruct, $invalidJson2);
$invalidJson3 = '{ "bar" : "baz", }';
test_exception($stringStruct, $invalidJson3);
$invalidJson4 = 'foo: bar';
test_exception($stringStruct, $invalidJson4);
// Restore THRIFT_ROOT
$GLOBALS['THRIFT_ROOT'] = $TMP_THRIFT_ROOT;
print "Success!";
return 0;
?>