Ejemplo n.º 1
0
 public function testOnLogin()
 {
     $count = 42;
     Cloud::onLogin(function ($user) use(&$count) {
         $count += 1;
     });
     Cloud::runOnLogin(null);
     $this->assertEquals(43, $count);
 }
Ejemplo n.º 2
0
    if ($params["convId"]) {
        return array("drop" => false);
    } else {
        return array("drop" => true);
    }
});
Cloud::define("getMeta", function ($params, $user, $meta) {
    return array("remoteAddress" => $meta["remoteAddress"]);
});
Cloud::define("updateObject", function ($params, $user) {
    $obj = $params["object"];
    $obj->set("__testKey", 42);
    return $obj;
});
Cloud::onLogin(function ($user) {
    error_log("Logging a user");
    return;
});
Cloud::onInsight(function ($job) {
    return;
});
Cloud::onVerified("sms", function ($user) {
    return;
});
Cloud::beforeSave("TestObject", function ($obj, $user) {
    $obj->set("__testKey", 42);
    return $obj;
});
Cloud::afterSave("TestObject", function ($obj, $user) {
    return;
});
Cloud::beforeDelete("TestObject", function ($obj, $user) {
Ejemplo n.º 3
0
    return "hello";
});
// define function with named params
Cloud::define("sayHello", function ($params, $user) {
    return "hello {$params['name']}";
});
Cloud::define("getMeta", function ($params, $user, $meta) {
    return array("remoteAddress" => $meta["remoteAddress"]);
});
Cloud::define("updateObject", function ($params, $user) {
    $obj = $params["object"];
    $obj->set("__testKey", 42);
    return $obj;
});
Cloud::onLogin(function ($user) {
    return;
});
Cloud::onInsight(function ($job) {
    return;
});
Cloud::onVerified("sms", function ($user) {
    return;
});
Cloud::beforeSave("TestObject", function ($obj, $user) {
    $obj->set("__testKey", 42);
    return $obj;
});
Cloud::afterSave("TestObject", function ($obj, $user) {
    return;
});
Cloud::beforeDelete("TestObject", function ($obj, $user) {