Exemple #1
0
 public function testSaveWhenWhere()
 {
     $obj = new Object("TestObject");
     $obj->set("score", 6);
     $obj->save();
     $this->assertNotEmpty($obj->getObjectId());
     $obj->set("level", "good");
     $query = new Query("TestObject");
     $query->greaterThanOrEqualTo("score", 8);
     $option = new SaveOption();
     $option->where = $query;
     $this->setExpectedException("LeanCloud\\CloudException");
     $obj->save($option);
     $query->greaterThanOrEqualTo("score", 6);
     $option->where = $query;
     $obj->increment("score");
     $obj->save($option);
     $this->assertEquals(7, $obj->get("score"));
 }