コード例 #1
0
ファイル: StatusManager.php プロジェクト: Maksold/platform
 /**
  * Set status as current
  *
  * @param User   $user
  * @param Status $status
  * @param bool   $reloadUser
  */
 public function setCurrentStatus(User $user, Status $status = null, $reloadUser = true)
 {
     $user->setCurrentStatus($status);
     $this->um->updateUser($user);
     if ($reloadUser) {
         $this->um->reloadUser($user);
     }
 }
コード例 #2
0
 public function testStatuses()
 {
     $user = new User();
     $status = new Status();
     $this->assertNotContains($status, $user->getStatuses());
     $this->assertNull($user->getCurrentStatus());
     $user->addStatus($status);
     $user->setCurrentStatus($status);
     $this->assertContains($status, $user->getStatuses());
     $this->assertEquals($status, $user->getCurrentStatus());
     $user->setCurrentStatus();
     $this->assertNull($user->getCurrentStatus());
     $user->getStatuses()->clear();
     $this->assertNotContains($status, $user->getStatuses());
 }