/**
  * 
  */
 public function testCompleteBuild()
 {
     $model = $this->objFromFixture('SiteTree', 'servicetest-page-1');
     $service = new CacheableNavigationService('Live', null, $model);
     // Cache should be empty
     $cachable = $service->getCacheableFrontEnd()->load($service->getIdentifier());
     $this->assertFalse($cachable->get_completed());
     // Populate the cache with a page
     $service->refreshCachedPage();
     // Set it to complete and re-test
     $service->completeBuild();
     $cachable = $service->getCacheableFrontEnd()->load($service->getIdentifier());
     $this->assertTrue($cachable->get_completed());
 }
 /**
  * 
  * @param array $modes
  * @param boolean $forceRemoval Whether to unset() children in {@link CacheableSiteTree::removeChild()}.
  * @return void
  */
 public function removePageCache($modes, $forceRemoval = true)
 {
     // Increase memory to max-allowable
     CacheableConfig::configure_memory_limit();
     $siteConfig = $this->owner->getSiteConfig();
     if (!$siteConfig->exists()) {
         $siteConfig = SiteConfig::current_site_config();
     }
     foreach ($modes as $stage => $mode) {
         $service = new CacheableNavigationService($mode, $siteConfig, $this->owner);
         $cache_frontend = $service->getCacheableFrontEnd();
         $id = $service->getIdentifier();
         $cached = $cache_frontend->load($id);
         if ($cached) {
             $cached_site_config = $cached->get_site_config();
             if (!$cached_site_config) {
                 $service->refreshCachedConfig();
             }
             $service->removeCachedPage($forceRemoval);
         }
     }
 }