Пример #1
0
 public function testUserFullname()
 {
     $user = new User();
     $user->setUsername('bert');
     $this->assertSame('bert', $user->getFullName());
     $user->setFullName('Bert Hekman');
     $this->assertSame('Bert Hekman', $user->getFullName());
 }
Пример #2
0
 /**
  * @param string   $username
  * @param string[] $roleList
  *
  * @return User
  */
 private function persistUser($username, array $roleList = array())
 {
     $user = new User();
     $user->setUsername($username);
     $user->setPlainPassword($username);
     $user->setEmail($username . '@example.local');
     $user->setRoles($roleList);
     $user->setEnabled(true);
     $this->setReference('user-' . $username, $user);
     $this->manager->persist($user);
     return $user;
 }