예제 #1
0
 public function testAssignNewRoleIgnoresDuplicates()
 {
     $user = new User('*****@*****.**');
     $user->assignNewRole(['ROLE_BLOGGER', 'ROLE_USER']);
     $expected = array('ROLE_USER', 'ROLE_BLOGGER');
     $this->assertEquals($expected, $user->getRoles());
 }
 public function testItCanAddUser()
 {
     $Manager = new YamlUserRepository($this->testFile);
     $User = new User('*****@*****.**');
     $User->setEmail('*****@*****.**');
     $User->setFirstName('New');
     $User->setLastName('User');
     $Manager->addUser($User);
     $User = $Manager->getUser('*****@*****.**');
     $this->assertEquals('*****@*****.**', $User->getUsername());
 }
예제 #3
0
 private function readUser($email)
 {
     $User = new User($email);
     $User->setEmail($email);
     $User->setFirstName($this->users[$email]['firstname']);
     $User->setLastName($this->users[$email]['lastname']);
     $User->assignNewRole($this->users[$email]['roles']);
     return $User;
 }