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'); } $t->info(' 2.3 - Enable a core plugin'); $enabler->enableSympalCorePlugins('sfDoctrineGuardPlugin'); $t->is(count($projConfiguration->getPlugins()), 1, '->enableSympalCorePlugins() enables the core plugin');