/**
  * initializes the application
  */
 private function initializeApplication()
 {
     // config
     $this->config = new Configuration($this->cache);
     $loaded = $this->config->isLoaded();
     // container
     $this->container = new DependencyContainer($this, $this->cache);
     $loaded = $loaded && $this->container->isLoaded();
     // routes
     $loaded = $loaded && $this->router->loadFromCache();
     // before middlewares
     $loaded = $loaded && $this->loadMiddlewareFromCache("before_middleware", "before");
     // after middlewares
     $loaded = $loaded && $this->loadMiddlewareFromCache("after_middleware", "after");
     // error
     $loaded = $loaded && $this->loadMiddlewareFromCache("error_middleware", "error");
     $this->loaded = $loaded;
 }
 public function testCacheInvalid()
 {
     file_put_contents(__DIR__ . "/tests_tmp/container", serialize("invalid"));
     $storage = new \FabysCore\Component\Cache\Storage\FileStorage(__DIR__ . "/tests_tmp");
     $cache = new \FabysCore\Component\Cache\Cache($storage);
     $appStub = $this->getMockBuilder('\\FabysCore\\Kernel\\Application')->disableOriginalConstructor()->getMock();
     $appStub->method("parameter")->willReturn("test_parameter");
     $container = new DependencyContainer($appStub, $cache);
     $this->assertTrue($container->isLoaded());
     unlink(__DIR__ . "/tests_tmp/container");
 }