public function __construct($name, ProjectConfiguration $configuration = null, sfFormatter $formatter = null) { $this->_name = sfSympalPluginToolkit::getShortPluginName($name); $this->_pluginName = sfSympalPluginToolkit::getLongPluginName($this->_name); $this->_pluginPath = sfSympalPluginToolkit::getPluginPath($this->_pluginName); $schema = sfFinder::type('file')->name('*.yml')->in($this->_pluginPath . '/config/doctrine'); $this->_pluginModels = array(); foreach ($schema as $file) { $this->_pluginModels = array_merge($this->_pluginModels, array_keys(sfYaml::load($file))); } $this->_contentTypeName = $this->getContentTypeForPlugin($this->_pluginName); $this->_configuration = is_null($configuration) ? ProjectConfiguration::getActive() : $configuration; $this->_dispatcher = $this->_configuration->getEventDispatcher(); $this->_formatter = is_null($formatter) ? new sfFormatter() : $formatter; $this->_filesystem = new sfFilesystem($this->_dispatcher, $this->_formatter); try { $this->_pluginConfig = $this->_configuration->getPluginConfiguration($this->_pluginName); } catch (Exception $e) { } }
<?php $app = 'sympal'; require_once dirname(__FILE__) . '/../../../bootstrap/unit.php'; $t = new lime_test(2); $t->info('1 - Test ::getPluginPath()'); $t->is(sfSympalPluginToolkit::getPluginPath('fakePlugin'), false, '::getPluginPath() returns false for a non-existent plugin'); $t->is(sfSympalPluginToolkit::getPluginPath('sfSympalBlogPlugin'), sfConfig::get('sf_plugins_dir') . '/sfSympalBlogPlugin', '::getPluginPath() returns the absolute path to a real plugin');