Esempio n. 1
0
 public function removeByUserId(UserId $userId)
 {
     $members = $this->toArray();
     foreach ($members as $member) {
         if ($userId->equals($member->userId())) {
             $this->remove($member);
             return;
         }
     }
     throw new CollectionElementAlreadyRemovedException();
 }
Esempio n. 2
0
 public function owner(UserId $userId)
 {
     foreach ($this->owners() as $owner) {
         if ($userId->equals($owner->userId())) {
             return $owner;
         }
     }
 }
Esempio n. 3
0
 function it_does_not_remove_by_user_id(MemberStub $member, UserId $userId, UserId $userId2)
 {
     $member->userId()->shouldBeCalled()->willReturn($userId2);
     $userId->equals($userId2)->shouldBeCalled()->willReturn(false);
     $this->shouldThrow(CollectionElementAlreadyRemovedException::class)->duringRemoveByUserId($userId);
 }
Esempio n. 4
0
 function it_does_not_gets_owner(UserId $userId, UserId $userId2)
 {
     $userId2->equals($userId)->shouldBeCalled()->willReturn(false);
     $this->owner($userId2)->shouldReturn(null);
 }