public function __construct(ProjectConfiguration $projectConfiguration) { /* * We disable Symfony autoload again feature because it is too slow in dev mode * If you introduce a new class when using sympal you just must clear your * cache manually */ sfAutoloadAgain::getInstance()->unregister(); $this->_projectConfiguration = $projectConfiguration; $this->_dispatcher = $projectConfiguration->getEventDispatcher(); $this->_configureDoctrine(); // Listen to the sympal.load event to perform some context-dependent tasks $this->_dispatcher->connect('sympal.load', array($this, 'bootstrapFromContext')); $this->_dispatcher->connect('sympal.cache.prime', array($this, 'listenSympalCachePrime')); }
public function __construct(ProjectConfiguration $projectConfiguration) { // We disable Symfony autoload again feature because it is too slow in dev mode // If you introduce a new class when using sympal you just must clear your // cache manually sfAutoloadAgain::getInstance()->unregister(); $this->_projectConfiguration = $projectConfiguration; $this->_dispatcher = $projectConfiguration->getEventDispatcher(); $this->_doctrineManager = Doctrine_Manager::getInstance(); $this->_initializeSymfonyConfig(); $this->_markClassesAsSafe(); $this->_configureSuperCache(); $this->_configureDoctrine(); new sfSympalContextLoadFactoriesListener($this->_dispatcher, $this); new sfSympalTaskClearCacheListener($this->_dispatcher, $this); }
* * Copyright (c) 2007 Yahoo! Inc. All rights reserved. * The copyrights embodied in the content in this file are licensed * under the MIT open source license. * * For the full copyright and license information, please view the LICENSE.yahoo * file that was distributed with this source code. */ $sf_symfony_lib_dir = '/Users/dustin/projects/symfony/branch/1.1/lib'; $sf_root_dir = realpath(dirname(__FILE__) . '/../../fixtures/project'); require_once $sf_root_dir . '/config/ProjectConfiguration.class.php'; $configuration = new ProjectConfiguration($sf_root_dir); // load lime require_once $configuration->getSymfonyLibDir() . '/vendor/lime/lime.php'; $t = new lime_test(28, new lime_output_color()); $d = new ysfConfigDimension($configuration->getEventDispatcher(), new sfNoCache(), array('set_default' => true)); foreach (array('initialize', 'loadConfiguration', 'clean', 'check', 'set', 'get', 'getCascade', 'getName', 'getAllowed', 'getDefault', 'getCache') as $method) { $t->can_ok($d, $method, sprintf('"%s" is a method of ysfConfigDimension', $method)); } $t->diag('::initialize()'); $t->isa_ok($d->getCache(), true, 'dimension cache is a valid cache adapter'); $t->diag('::loadConfiguration()'); $t->is($d->getOption('set_default'), true, 'dimension configuration is loaded after initialization'); $t->is($d->get(), array('culture' => 'en', 'host' => 'sp1'), 'dimension is valid after initialization'); $t->is($d->getDefault(), array('culture' => 'en', 'host' => 'sp1'), 'default is valid after initialization'); $t->is($d->getAllowed(), array('culture' => array('en', 'fr', 'it', 'de'), 'skin' => array('corp', 'mybrand'), 'host' => array('sp1', 're4')), 'allowed is valid after initialization'); $t->is($d->getCascade(), array('en_sp1', 'en', 'sp1'), 'cascade is valid after initialization'); $t->diag('::clean()'); $t->is($d->clean(array('culture' => 'en', 'skin' => null, 'host' => null)), array('culture' => 'en'), 'removes keys with null values'); $t->is($d->clean(array('culture' => 'en', 'skin' => 'corp', 'host' => 'sp1')), array('culture' => 'en', 'skin' => 'corp', 'host' => 'sp1'), 'strtolower all values'); $t->diag('::check()');