예제 #1
0
$paths = $projConfiguration->getPluginPaths();
$t->is($paths[0], realpath(dirname(__FILE__) . '/../../lib/plugins/sfDoctrineGuardPlugin'), 'The plugin path of the core plugin is inside the lib/plugins dir of sympal');
$t->info('  2.4 - Disable a core plugin');
$enabler->disableSympalCorePlugins(array('sfDoctrineGuardPlugin'));
$t->is(count($projConfiguration->getPlugins()), 0, '->disableSympalCorePlugins() disables the core plugin');
$corePluginsCount = count(sfSympalPluginConfiguration::$corePlugins);
$installedPluginsCount = 3;
// in the test project's plugin directory
$otherPluginsCount = 2;
// sfSympalPlugin + sfDoctrinePlugin
$totalPluginsCount = $corePluginsCount + $installedPluginsCount + $otherPluginsCount;
$enabler->enableSympalPlugins();
$enablerApp1->enableSympalPlugins();
$enablerApp2->enableSympalPlugins();
$t->is(count($projConfiguration->getPlugins()), $totalPluginsCount, '->enableSympalPlugins() enables core plugins + anything in the plugins directory');
$t->is(count($appEnabledConfiguration->getPlugins()), $totalPluginsCount, '->enableSympalPlugins() enables core plugins + anything in the plugins directory');
$t->is(count($appDisabledConfiguration->getPlugins()), 0, '->enableSympalPlugins() enables no plugins if sympal is disabled for the application');
$t->info('  2.5 - Test overrideSympalPlugin()');
$projConfiguration->disablePlugins($projConfiguration->getPlugins());
$enabler->enableSympalCorePlugins(array('sfDoctrineGuardPlugin'));
$t->is(count($projConfiguration->getPlugins()), 1, 'Sanity check');
$enabler->overrideSympalPlugin('sfDoctrineGuardPlugin');
$t->is(count($projConfiguration->getPlugins()), 1, 'After overrideSympalPlugin(), the sfDoctrineGuardPlugin is still enabled');
$paths = $projConfiguration->getPluginPaths();
/*
 * The plugin path is false because it doesn't exist in the plugins directory.
 * I can't think of a good way to test this short of creating an sfDoctrineGuardPlugin
 * somewhere and pointing there. sfProjectConfiguration calls realpath, so
 * my attempts to set it to a non-existent dir result in a path of "false"
 */
$t->is($paths[0], false, 'The plugin path to the plugin has changed, however');