Example #1
0
 /**
  * @test
  */
 public function shouldGroupByCategoryUsingArray()
 {
     //given
     $category = Category::create(array('name' => 'computer'));
     Product::create(array('name' => 'notebook', 'id_category' => $category->getId()));
     //when
     $result = Product::select('id_category, count(*)')->groupBy(array('id_category'))->fetchAll();
     //then
     Assert::thatArray($result)->containsOnly(array($category->getId(), 1));
 }