Exemplo n.º 1
0
    }
    public static function clear()
    {
        self::$cache = array();
    }
}
$context = sfContext::getInstance();
$context->controller = new myController();
$context->controller->initialize($context);
$context->request = new myRequest();
$r = sfRouting::getInstance();
$r->connect('default', '/:module/:action/*');
// ->initialize()
$t->diag('->initialize()');
$m = new sfViewCacheManager();
$t->is($m->getContext(), null, '->initialize() takes a sfContext object as its first argument');
// ->getContext()
$t->diag('->getContext()');
$m->initialize($context, 'myCache');
$t->is($m->getContext(), $context, '->getContext() returns the current context');
// ->generateNamespace()
$t->diag('->generateNamespace()');
$m = get_cache_manager($context);
// ->addCache()
$t->diag('->addCache()');
$m = get_cache_manager($context);
$m->set('test', 'module/action');
$t->is($m->has('module/action'), false, '->addCache() register a cache configuration for an action');
$m->addCache('module', 'action', get_cache_config());
$m->set('test', 'module/action');
$t->is($m->get('module/action'), 'test', '->addCache() register a cache configuration for an action');