public function testIncludePath() { Config::includePath('foo/bar'); $cfg = Config::getConfiguration(); $this->assertEquals(1, count($cfg[Config::PATHS])); Config::includePath('foo/bar2'); $cfg = Config::getConfiguration(); $this->assertEquals(2, count($cfg[Config::PATHS])); }
public function testRequestCache() { // Munge the config. include self::config; Config::cache('foo')->whichInvokes('MockAlwaysReturnFooCache'); $config = Config::getConfiguration(); //$config[Config::CACHES]['foo']['class'] = 'MockAlwaysReturnFooCache'; Config::initialize($config); $ff = new FortissimoHarness(); ob_start(); $ff->handleRequest('testRequestCache1'); $res = ob_get_contents(); ob_end_clean(); $this->assertEquals('foo', $res); unset($config[Config::CACHES]['foo']); // Second, test to see if values can be written to cache. //$config[Config::CACHES]['foo']['class'] = 'MockAlwaysSetValueCache'; Config::cache('foo')->whichInvokes('MockAlwaysSetValueCache')->withParam('isDefault')->whoseValueIs(TRUE); //Config::initialize($config); $ff = new FortissimoHarness(); ob_start(); $ff->handleRequest('testRequestCache2'); $res = ob_get_contents(); ob_end_clean(); $cacheManager = $ff->cacheManager(); $key = $ff->genCacheKey('testRequestCache2'); $this->assertEquals('bar', $cacheManager->get($key), 'Has cached item.'); // We also want to make sure that the output was passed on correctly. $this->assertEquals('bar', $res, 'Output was passed through correctly.'); // Finally, make sure that a request still works if no cacher is configured. $ff = new FortissimoHarness(self::config); ob_start(); $ff->handleRequest('testRequestCache2'); $res = ob_get_contents(); ob_end_clean(); $this->assertEquals('bar', $res); }