예제 #1
0
 public function testFind()
 {
     $obj = new LeanObject("TestObject");
     $id = microtime();
     $obj->set("testid", $id);
     $obj->save();
     $query = new LeanQuery("TestObject");
     $query->equalTo("testid", $id);
     $objects = $query->find();
     $this->assertEquals(1, count($objects));
     $this->assertEquals($id, $objects[0]->get("testid"));
     $obj->destroy();
 }
예제 #2
0
 public function testDestroyObject()
 {
     $obj = new LeanObject("TestObject");
     $obj->set("tags", array("frontend"));
     $obj->save();
     $this->assertNotEmpty($obj->getObjectId());
     $obj->destroy();
     $this->setExpectedException("LeanCloud\\LeanException");
     $obj->fetch();
 }
예제 #3
0
 public function delete()
 {
     $object = new LeanObject("TestObject", '5655637160b2febec4a56259');
     $object->destroy();
 }
예제 #4
0
 public function testSaveObjectWithFile()
 {
     $obj = new LeanObject("TestObject");
     $obj->set("name", "alice");
     $file = LeanFile::createWithData("test.txt", "你好,中国!");
     $obj->addIn("files", $file);
     $obj->save();
     $this->assertNotEmpty($obj->getObjectId());
     $this->assertNotEmpty($file->getObjectId());
     $this->assertNotEmpty($file->getUrl());
     $file->destroy();
     $obj->destroy();
 }
예제 #5
0
 public function testDoCloudQueryWithPvalues()
 {
     $obj = new LeanObject("TestObject");
     $obj->set("name", "alice");
     $obj->save();
     $resp = LeanQuery::doCloudQuery("SELECT * FROM TestObject " . "WHERE name = ? LIMIT ?", array("alice", 1));
     $this->assertGreaterThan(0, count($resp["results"]));
     $obj->destroy();
 }