setName() public method

Set name
public setName ( string $name ) : Newscoop\Entity\User\Group
$name string
return Newscoop\Entity\User\Group
Esempio n. 1
0
 public function testGetEditors()
 {
     $blogRole = new Group();
     $blogRole->setName('blogger');
     $author1 = new Author('tic1', 'toc');
     $author2 = new Author('tic2', 'toc');
     $this->em->persist($blogRole);
     $this->em->persist($author1);
     $this->em->persist($author2);
     $this->em->flush();
     $user = new User();
     $user->setUsername('user')->setEmail('*****@*****.**')->setActive(true);
     $admin = new User();
     $admin->setUsername('admin')->setEmail('*****@*****.**')->setActive(true)->setAdmin(true);
     $editor = new User();
     $editor->setUsername('editor')->setEmail('*****@*****.**')->setActive(true)->setAdmin(true)->setAuthor($author1);
     $blogger = new User();
     $blogger->setUsername('blogger')->setEmail('*****@*****.**')->setActive(true)->setAdmin(true)->setAuthor($author2)->addUserType($blogRole);
     $this->em->persist($user);
     $this->em->persist($admin);
     $this->em->persist($editor);
     $this->em->persist($blogger);
     $this->em->flush();
     $service = new ListUserService(array('blog' => array('role' => $blogRole->getId())), $this->em);
     $editors = $service->findEditors();
     $this->assertEquals(1, count($editors));
     $this->assertEquals($editor->getId(), $editors[0]->getId());
     $this->assertEquals(1, $service->getEditorsCount());
 }
Esempio n. 2
0
 /**
  * Save group
  *
  * @param Newscoop\Entity\User\Group $group
  * @param array $values
  * @return void
  */
 public function save(Group $group, array $values)
 {
     $em = $this->getEntityManager();
     $group->setName($values['name']);
     if (!$group->getRoleId()) {
         $role = new Role();
         $em->persist($role);
         $group->setRole($role);
     }
     $em->persist($group);
     $em->flush();
 }
Esempio n. 3
0
 public function testSaveWithGroup()
 {
     $group = new Group();
     $group->setName('test');
     $this->em->persist($group);
     $user = new User('name');
     $user->addUserType($group);
     $this->repository->save($user, array('username' => 'uname', 'email' => '*****@*****.**', 'user_type' => array()));
     $this->assertEquals(0, count($user->getGroups()));
 }
 public function setName($name)
 {
     $this->__load();
     return parent::setName($name);
 }