/** * testCountMenuItem * * @return void */ public function testCountMenuItem() { $conn = $this->getConnectionMock(); $query = $this->getQueryBuilderMock(); $keygen = $this->getKeygenMock(); $conn->shouldReceive('table')->with(self::MENU_ITEM_TABLE)->andReturn($query); $query->shouldReceive('where')->andReturn($query); $query->shouldReceive('count')->andReturn(1); $menuRepository = new DBMenuRepository($conn, $keygen); $count = $menuRepository->countItem('freeboard'); $this->assertEquals(1, $count); }