예제 #1
0
 public function testMetaData()
 {
     $file = LeanFile::createWithData("test.txt", "你好,中国!");
     $file->setMeta("language", "zh-CN");
     $file->setMeta("bool", false);
     $file->setMeta("downloads", 100);
     $file->save();
     $file2 = LeanFile::fetch($file->getObjectId());
     $this->assertEquals("zh-CN", $file2->getMeta("language"));
     $this->assertEquals(false, $file2->getMeta("bool"));
     $this->assertEquals(100, $file2->getMeta("downloads"));
     $file->destroy();
 }
예제 #2
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();
 }