Example #1
0
 public function testCreateWithURL()
 {
     $file = File::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 call error
     $avatar = File::createWithUrl("alice.png", "https://leancloud.cn/favicon.png");
     $user = User::logIn("alice", "blabla");
     $user->set("avatar", $avatar);
     $user->save();
     $token = User::getCurrentSessionToken();
     $user->logOut();
     User::setCurrentSessionToken($token);
     $user2 = User::getCurrentUser();
     $this->assertEquals($user2->getUsername(), "alice");
 }