/** * @test * @group grouprepo */ public function should_return_groups_of_kind() { $level = $this->kindRepo->get('level'); $classgroup = $this->kindRepo->get('classgroup'); $levels = $this->groupRepo->groupsOfKind($level); $this->assertCount(3, $levels); $classgroups = $this->groupRepo->groupsOfKind($classgroup); $this->assertCount(1, $classgroups); }
public function createUsers() { $male = new Gender('m'); $female = new Gender('f'); $users = [['fn' => 'Karl', 'ln' => 'Van Iseghem', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->klimtoren, $this->wassenaard, $this->boompje, $this->loopbrug], 'roles' => [$this->sa]], ['fn' => 'Bart', 'ln' => 'Verfaillie', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->wassenaard], 'roles' => [$this->website_moderator]], ['fn' => 'Lut', 'ln' => 'Ghyoot', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->wassenaard], 'roles' => [$this->website_moderator]], ['fn' => 'Geertrui', 'ln' => 'Deprijcker', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->loopbrug], 'roles' => [$this->website_moderator]], ['fn' => 'Myriam', 'ln' => 'Monstrey', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->loopbrug], 'roles' => [$this->website_moderator]], ['fn' => 'Annemie', 'ln' => 'Demaré', 'un' => '*****@*****.**', 'pwd' => 'password', 'realms' => [$this->boompje], 'roles' => [$this->website_moderator]]]; $emp = $this->kindRepo->get('employee'); foreach ($users as $arr_user) { //CREATE USER $firstName = new Name($arr_user['fn']); $lastName = new Name($arr_user['ln']); $userName = new Username($arr_user['un']); $pwd = new HashedPassword(bcrypt($arr_user['pwd'])); $reset_email = new Email($userName->toString()); $user = User::register($firstName, $lastName, $userName, $pwd, $reset_email, $male); $this->manager->persist($user); //SET RELATION // $rel = PartyRelation::register($user, $arr_user['realms'][0], $emp); //$this->manager->merge($rel); //Set Roles foreach ($arr_user['roles'] as $role) { $ur = UserRole::register($user, $role, $arr_user['realms'][0]); $this->manager->persist($ur); } foreach ($arr_user['realms'] as $realm) { $ur = UserRole::register($user, $this->user_role, $realm); $this->manager->persist($ur); } } $this->manager->flush(); }