public function testGetCachedSiteInstanceRoutesThrowException()
 {
     $this->setExpectedException('Xpressengine\\Routing\\Exceptions\\NotFoundInstanceRouteException');
     $cache = $this->cache;
     $cache->shouldReceive('has')->andReturn(false);
     $cacheHandler = new InstanceRouteCacheHandler($cache, true);
     $cacheHandler->getCachedSiteInstanceRoutes('testSite');
 }
 /**
  * Get All Instance Route of site
  * return list of all Instance Route from Repo
  *
  * @param string $siteKey to get siteKey
  *
  * @return InstanceRoute[]
  */
 public function getsBySite($siteKey)
 {
     if ($this->cache->isExistCachedSiteInstanceRoutes($siteKey)) {
         $instanceRoutes = $this->cache->getCachedSiteInstanceRoutes($siteKey);
         array_merge($this->loadedInstanceRoutes, $instanceRoutes);
         return $instanceRoutes;
     }
     $filter = function ($query) use($siteKey) {
         return $query->where('site', '=', $siteKey);
     };
     $instanceRoutes = $this->instanceRouteRepository->fetch($filter);
     $this->loadedInstanceRoutes = array_merge($this->loadedInstanceRoutes, $instanceRoutes);
     $this->cache->setSiteInstanceCache($siteKey, $instanceRoutes);
     return $instanceRoutes;
 }