Example #1
0
 public function testCreateWithURL()
 {
     $file = LeanFile::createWithUrl("blabla.png", "https://leancloud.cn/favicon.png");
     $this->assertEquals("blabla.png", $file->getName());
     $this->assertEquals("https://leancloud.cn/favicon.png", $file->getUrl());
     $this->assertEquals("image/png", $file->getMimeType());
 }
Example #2
0
 public function testCircularGetCurrentUser()
 {
     // ensure getCurrentUser neither run indefinetely, nor throw maximum
     // function all error
     $avatar = LeanFile::createWithUrl("alice.png", "https://leancloud.cn/favicon.png");
     $user = LeanUser::logIn("alice", "blabla");
     $user->set("avatar", $avatar);
     $user->save();
     $token = LeanUser::getCurrentSessionToken();
     $user->logOut();
     LeanUser::setCurrentSessionToken($token);
     $user2 = LeanUser::getCurrentUser();
     $this->assertEquals($user2->getUsername(), "alice");
 }