/**
  * Return All Menu
  *
  * @param string $siteKey site key
  *
  * @return MenuEntity[]
  */
 public function getAllMenu($siteKey)
 {
     $menus = [];
     $menuIds = $this->menuRepository->findAllMenuIds($siteKey);
     foreach ($menuIds as $menuId) {
         if ($this->cache->isExistCachedMenu($menuId)) {
             $menu = $this->cache->getCachedMenu($menuId);
         } else {
             $menu = $this->menuRepository->findMenu($menuId);
             $this->applyMenuPermission($menu);
             $this->cache->setCachedMenu($menu);
         }
         $menus[$menu->id] = $menu;
     }
     return $menus;
 }
 /**
  * testFindAllMenuIds
  *
  * @return void
  */
 public function testFindAllMenuIds()
 {
     $conn = $this->getConnectionMock();
     $keygen = $this->getKeygenMock();
     $repoInstance = new DBMenuRepository($conn, $keygen);
     $query = $this->getQueryBuilderMock();
     $siteKey = 'default';
     $conn->shouldReceive('table')->andReturn($query);
     $query->shouldReceive('where')->andReturn($query);
     $query->shouldReceive('get')->andReturn([['id' => 'main'], ['id' => 'bottom'], ['id' => 'side']]);
     $menuIds = $repoInstance->findAllMenuIds($siteKey);
     $this->assertEquals(['main', 'bottom', 'side'], $menuIds);
 }