/** * testMenuCountItem * * @return void */ public function testMenuCountItem() { $treeCollection = $this->getTreeCollection(); $menu = new MenuEntity(['id' => 'main', 'title' => '기본메뉴', 'description' => '기본메뉴입니다.'], $treeCollection); $countItem = $menu->countItem(); $this->assertEquals(4, $countItem); }
/** * Delete Menu * * @param MenuEntity $menu menu to delete * * @throws CanNotDeleteMenuEntityHaveChildException * @return void */ public function removeMenu(MenuEntity $menu) { if ($menu->countItem() > 0) { throw new CanNotDeleteMenuEntityHaveChildException(); } $this->menuRepository->deleteMenu($menu); $this->cache->deleteCachedMenu($menu->id); $this->cache->forgetMenuMap($menu); }