Exemplo n.º 1
0
 public function testUserLogin()
 {
     $data = array("username" => "testuser", "password" => "5akf#a?^G", "phone" => "18612340000");
     $resp = Client::post("/users", $data);
     $this->assertNotEmpty($resp["objectId"]);
     $this->assertNotEmpty($resp["sessionToken"]);
     $id = $resp["objectId"];
     $resp = Client::get("/users/me", array("session_token" => $resp["sessionToken"]));
     $this->assertNotEmpty($resp["objectId"]);
     Client::delete("/users/{$id}", $resp["sessionToken"]);
     // Raise 211: Could not find user.
     $this->setExpectedException("LeanCloud\\CloudException", null, 211);
     $resp = Client::get("/users/me", array("session_token" => "non-existent-token"));
 }
Exemplo n.º 2
0
 /**
  * Delete file on cloud
  *
  * @throws CloudException
  */
 public function destroy()
 {
     if (!$this->getObjectId()) {
         return false;
     }
     Client::delete("/files/{$this->getObjectId()}");
 }
Exemplo n.º 3
0
 public function testDeleteTestObject()
 {
     $data = Client::post("/classes/TestObject", array("name" => "alice", "story" => "in wonderland"));
     $this->assertArrayHasKey("objectId", $data);
     Client::delete("/classes/TestObject/{$data['objectId']}");
     $obj = Client::get("/classes/TestObject/{$data['objectId']}");
     $this->assertEmpty($obj);
 }