Beispiel #1
0
 /** @test */
 public function should_have_members_collection()
 {
     $group = new Group(GroupId::generate(), 'Cribbb');
     $group->addMember($this->user);
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $group->members());
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Groups\\Member', $group->members()->first());
 }
Beispiel #2
0
 /** @test */
 public function should_become_a_member_of_a_group()
 {
     $user = User::register(UserId::generate(), new Email('*****@*****.**'), new Username('zuck'), new HashedPassword('facemash'));
     $group = new Group(GroupId::generate(), 'Porcellian');
     $this->assertEquals(0, $group->members()->count());
     $this->assertEquals(0, $user->memberOf()->count());
     $user->addAsMemberOf($group);
     $this->assertEquals(1, $group->members()->count());
     $this->assertEquals(1, $user->memberOf()->count());
 }