本文整理汇总了PHP中sfProjectConfiguration::getEventDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP sfProjectConfiguration::getEventDispatcher方法的具体用法?PHP sfProjectConfiguration::getEventDispatcher怎么用?PHP sfProjectConfiguration::getEventDispatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfProjectConfiguration
的用法示例。
在下文中一共展示了sfProjectConfiguration::getEventDispatcher方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param sfProjectConfiguration $configuration The project configuration
* @param string $rootDir The plugin root directory
* @param string $name The plugin name
*/
public function __construct(sfProjectConfiguration $configuration, $rootDir = null, $name = null)
{
$this->configuration = $configuration;
$this->dispatcher = $configuration->getEventDispatcher();
$this->rootDir = null === $rootDir ? $this->guessRootDir() : realpath($rootDir);
$this->name = null === $name ? $this->guessName() : $name;
$this->setup();
$this->configure();
if (!$this->configuration instanceof sfApplicationConfiguration) {
$this->initializeAutoload();
$this->initialize();
}
}
示例2: initialize
/**
* @param sfProjectConfiguration $configuration
*
* @return fpErrorNotifier
*/
public static function initialize(sfProjectConfiguration $configuration)
{
if (empty(self::$instance)) {
$configFiles = $configuration->getConfigPaths('config/notify.yml');
$config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles);
foreach ($config as $name => $value) {
sfConfig::set("sf_notify_{$name}", $value);
}
self::$instance = new self($configuration->getEventDispatcher());
self::getInstance()->handler()->initialize();
}
return self::$instance;
}
示例3: setup
{
public function setup()
{
$this->enablePlugins('sfAutoloadPlugin');
}
}
// ->guessRootDir() ->guessName()
$t->diag('->guessRootDir() ->guessName()');
$configuration = new sfProjectConfiguration($rootDir);
$pluginConfig = new sfAutoloadPluginConfiguration($configuration);
$t->is($pluginConfig->getRootDir(), $pluginRoot, '->guessRootDir() guesses plugin root directory');
$t->is($pluginConfig->getName(), 'sfAutoloadPlugin', '->guessName() guesses plugin name');
// ->filterTestFiles()
$t->diag('->filterTestFiles()');
// test:all
$task = new sfTestAllTask($configuration->getEventDispatcher(), new sfFormatter());
$event = new sfEvent($task, 'task.test.filter_test_files', array('arguments' => array(), 'options' => array()));
$files = $pluginConfig->filterTestFiles($event, array());
$t->is(count($files), 6, '->filterTestFiles() adds all plugin tests');
// test:functional
$task = new sfTestFunctionalTask($configuration->getEventDispatcher(), new sfFormatter());
$event = new sfEvent($task, 'task.test.filter_test_files', array('arguments' => array('controller' => array()), 'options' => array()));
$files = $pluginConfig->filterTestFiles($event, array());
$t->is(count($files), 3, '->filterTestFiles() adds functional plugin tests');
$task = new sfTestFunctionalTask($configuration->getEventDispatcher(), new sfFormatter());
$event = new sfEvent($task, 'task.test.filter_test_files', array('arguments' => array('controller' => array('BarFunctional')), 'options' => array()));
$files = $pluginConfig->filterTestFiles($event, array());
$t->is(count($files), 1, '->filterTestFiles() adds functional plugin tests when a controller is specified');
$task = new sfTestFunctionalTask($configuration->getEventDispatcher(), new sfFormatter());
$event = new sfEvent($task, 'task.test.filter_test_files', array('arguments' => array('controller' => array('nested/NestedFunctional')), 'options' => array()));
$files = $pluginConfig->filterTestFiles($event, array());
示例4: __construct
/**
* Constructor.
*
* @see sfTask
*/
public function __construct(sfProjectConfiguration $configuration, sfFormatter $formatter)
{
parent::__construct($configuration->getEventDispatcher(), $formatter);
$this->configuration = $configuration;
$this->pluginConfiguration = $configuration->getPluginConfiguration('sfTaskExtraPlugin');
}
示例5: __construct
/**
*
* @param sfProjectConfiguration $cfg
*/
public function __construct(sfProjectConfiguration $cfg)
{
$this->dispatcher = $cfg->getEventDispatcher();
$this->configuration = $cfg;
}