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(); }
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(); }
public function delete() { $object = new LeanObject("TestObject", '5655637160b2febec4a56259'); $object->destroy(); }
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(); }
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(); }