public function testCacheInvalid() { file_put_contents(__DIR__ . "/tests_tmp/config", serialize("invalid")); $storage = new \FabysCore\Component\Cache\Storage\FileStorage(__DIR__ . "/tests_tmp"); $cache = new \FabysCore\Component\Cache\Cache($storage); $config = new Configuration($cache); $this->assertTrue($config->isLoaded()); $value = $config->parameter("test", "default"); $this->assertEquals("default", $value); }
/** * 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; }