Example #1
0
 /**
  * @test
  */
 public function shouldCountRecordsWithJoinWithOtherTable()
 {
     //given
     Product::create(array('name' => 'other'));
     $product = Product::create(array('name' => 'phones'));
     Order::create(array('name' => 'other'));
     $order = Order::create(array('name' => 'a'));
     OrderProduct::create(array('id_order' => $order->getId(), 'id_product' => $product->getId()));
     //when
     $products = Product::join('orderProduct')->where('id_order IS NOT NULL')->count();
     //then
     $this->assertEquals(1, $products);
 }