Example #1
0
 /**
  * Tests whether the constructor works as expected.
  *
  * @return void
  */
 public function testConstructorSetsParametersCorrectly()
 {
     $user = new UserEntity('username', 'passwordHash', 'emailAddress', 'firstName', 'lastName');
     $this->assertNull($user->getId());
     $this->assertSame('username', $user->getUsername());
     $this->assertSame('passwordHash', $user->getPasswordHash());
     $this->assertSame('emailAddress', $user->getEmailAddress());
     $this->assertSame('firstName', $user->getFirstName());
     $this->assertSame('lastName', $user->getLastName());
     $this->assertSame('firstName lastName', $user->getDisplayName());
     $this->assertEmpty($user->getRoles()->count());
 }
Example #2
0
 /**
  * Returns whether the given user is authenticated.
  *
  * Returns TRUE in case the given user is authenticated.
  * Otherwise returns FALSE.
  *
  * @param \Ableron\Modules\Core\Model\Entities\UserEntity $user The user to check
  * @return bool
  */
 public static function isAuthenticated(UserEntity $user)
 {
     return $user->getId() !== null;
 }