Beispiel #1
0
 /**
  * get counts group by options
  *
  * @param string $targetId target id
  * @return array
  * @deprecated
  */
 public function countsByOption($targetId)
 {
     $wheres = ['targetId' => $targetId, 'counterName' => $this->name];
     return $this->repo->countsByOption($wheres);
 }
 /**
  * test get count group by option
  *
  * @return void
  */
 public function testCountByOption()
 {
     $conn = $this->conn;
     $query = $this->query;
     $repo = new Repository($conn);
     $query->shouldReceive('wheres')->andReturn($query);
     $query->shouldReceive('groupBy')->andReturn($query);
     $query->shouldReceive('raw');
     $query->shouldReceive('get')->andReturn([0, 1]);
     $result = $repo->countsByOption([]);
     $this->assertEquals([0, 1], $result);
 }