示例#1
0
 public function testDoCloudQueryWithPvalues()
 {
     $obj = new Object("TestObject");
     $obj->set("name", "alice");
     $obj->save();
     $resp = Query::doCloudQuery("SELECT * FROM TestObject " . "WHERE name = ? LIMIT ?", array("alice", 1));
     $this->assertGreaterThan(0, count($resp["results"]));
     $obj->destroy();
 }
示例#2
0
 public function testSaveObjectWithFile()
 {
     $obj = new Object("TestObject");
     $obj->set("name", "alice");
     $file = File::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();
 }
示例#3
0
 public function testGeoPointLocation()
 {
     $point = new GeoPoint(25.269876, 110.333061);
     $location = new Object("Location");
     $location->set("location", $point);
     $location->save();
     $location->destroy();
 }
示例#4
0
文件: User.php 项目: juvenn/php-sdk
 /**
  * Link user with 3rd party provider
  *
  * @param string $provider  Provider name e.g. "weibo", "weixin"
  * @param array  $authToken Array of id, token, and expiration info
  * @return self
  */
 public function linkWith($provider, $authToken)
 {
     if (!is_string($provider) || empty($provider)) {
         throw new \InvalidArgumentException("Provider name can only " . "be string.");
     }
     $data = $this->get("authData");
     if (!$data) {
         $data = array();
     }
     $data[$provider] = $authToken;
     $this->set("authData", $data);
     parent::save();
     return $this;
 }