/** * findMenuIdOnMap * * @param string $itemId menu item object id * * @return string */ protected function findMenuIdOnMap($itemId) { $menuMap = $this->cache->getMenuMap(); if (isset($menuMap[$itemId])) { $menuId = $menuMap[$itemId]; if ($menuId !== null) { return $menuId; } } $menuId = $this->menuRepository->getMenuIdByItem($itemId); return $menuId; }
/** * 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); }