/**
  * Shortcut method to enable all Sympal plugins for the given ProjectConfiguration
  *
  * Returns an instance of sfSympalPluginEnabler which allows you to enable
  * disable and override any plugins with a convenient API.
  *
  * @param ProjectConfiguration $configuration
  * @return sfSympalPluginEnabler $enabler  Instance of sfSympalPluginEnabler
  */
 public static function enableSympalPlugins(ProjectConfiguration $configuration)
 {
     require_once dirname(__FILE__) . '/../lib/sfSympalPluginEnabler.class.php';
     $enabler = new sfSympalPluginEnabler($configuration);
     $enabler->enableSympalPlugins();
     return $enabler;
 }
}
class enabledApplicationStubConfiguration extends ApplicationStubConfiugration
{
}
class disabledApplicationStubConfiguration extends ApplicationStubConfiugration
{
    const disableSympal = true;
}
// setup some configurations
$projConfiguration = new ProjectConfigurationStub();
$appEnabledConfiguration = new enabledApplicationStubConfiguration('test', true);
$appDisabledConfiguration = new disabledApplicationStubConfiguration('test', true);
// setup some enablers
$enabler = new sfSympalPluginEnabler($projConfiguration);
$enablerApp1 = new sfSympalPluginEnabler($appEnabledConfiguration);
$enablerApp2 = new sfSympalPluginEnabler($appDisabledConfiguration);
$t->info('1 - Test the isSympalEnabled() functionality');
$t->is($enabler->isSympalEnabled(), true, '->isSympalEnabled() returns true for all ProjectConfiguration instances');
$t->is($enablerApp1->isSympalEnabled(), true, '->isSympalEnabled() returns true for an ApplicationConfiguration instance without the disableSympal constant');
$t->is($enablerApp2->isSympalEnabled(), false, '->isSympalEnabled() returns false for an ApplicationConfiguration instance WITH the disableSympal constant equal to true');
$t->info('2 - Test the enabling/disabling of plugins');
$t->info('  2.1 - Sanity checks');
$t->is(count($projConfiguration->getPlugins()), 0, 'Initially there are 0 enabled plugins');
$t->is(count($appEnabledConfiguration->getPlugins()), 0, 'Initially there are 0 enabled plugins');
$t->is(count($appDisabledConfiguration->getPlugins()), 0, 'Initially there are 0 enabled plugins');
$t->info('  2.2 - Using enableSympalCorePlugins() for a plugin that does not exist inside sympal throws an exception');
try {
    $enabler->enableSympalCorePlugins('fake');
    $t->fail('Exception not thrown');
} catch (sfException $e) {
    $t->pass('Exception thrown');