Example #1
0
 /**
  * $targetId 에 $authorId 가 포함 되어있는지 확인
  *
  * @param string                $targetId targetId
  * @param MemberEntityInterface $author   user instance
  * @return bool
  * @throws Exceptions\InvalidTypeException
  */
 public function invoked($targetId, MemberEntityInterface $author)
 {
     if ($this->isSession() === false && $author instanceof Guest) {
         throw new Exceptions\InvalidTypeException();
     } elseif ($this->isSession() === true && $author instanceof Guest) {
         return $this->session->invoked($targetId);
     } else {
         return $this->get($targetId, $author) !== null;
     }
 }
 /**
  * test not invoked
  *
  * @return void
  */
 public function testNotInvoked()
 {
     $session = $this->session;
     $counter = new SessionCounter($session);
     $counter->init('id-session', 'default');
     $session->shouldReceive('get')->andReturn(['id-session' => []]);
     $result = $counter->invoked('targetId');
     $this->assertFalse($result);
 }