/**
  * test insert
  *
  * @return void
  */
 public function testInsert()
 {
     $conn = $this->conn;
     $query = $this->query;
     $repo = new Repository($conn);
     $query->shouldReceive('insert');
     $repo->insert('name', 'option', 'targetId', 'userId', '127.0.0.1', 1);
 }
Example #2
0
 /**
  * add counter log
  *
  * @param string                $targetId targetId
  * @param MemberEntityInterface $author   user instance
  * @param int                   $point    point
  * @return void
  * @throws Exceptions\LoginRequiredException
  */
 public function add($targetId, MemberEntityInterface $author = null, $point = 1)
 {
     $author = $this->getUser($author);
     if ($this->invoked($targetId, $author) === true) {
         throw new Exceptions\InvokedException();
     }
     if ($this->isSession() === true && $author instanceof Guest) {
         $this->session->add($targetId);
         $ip = $this->request->ip();
         $this->repo->insert($this->name, $this->option, $targetId, '', $ip, $point);
     }
     if ($author->getId() != '') {
         $ip = $this->request->ip();
         $this->repo->insert($this->name, $this->option, $targetId, $author->getId(), $ip, $point);
     }
 }