$t->pass($e->getMessage());
}
$t->info('  2.2 - Set a real theme with a bad layout name throws InvalidArgumentException');
$badThemeConfig = $themeConfig;
$badThemeConfig['layout'] = 'non_existent';
$manager->addTheme('bad_theme', $badThemeConfig);
try {
    $manager->setCurrentTheme('bad_theme');
    $t->fail('No exception thrown');
} catch (InvalidArgumentException $e) {
    $t->pass($e->getMessage());
}
$t->info('  2.3 - Set a real, valid theme and view the results');
$manager->addTheme('good_theme', $themeConfig);
$manager->setCurrentTheme('good_theme');
$t->is($manager->getCurrentTheme(), 'good_theme', '->getCurrentTheme() returns "good_theme"');
$t->is($manager->getCurrentThemeObject()->getLayout(), 'app_test_layout', '->getCurrentThemeObject() returns the right theme object');
// The module & action will be seen as default/index
$layoutPath = sfConfig::get('sf_root_dir') . '/apps/frontend/templates/app_test_layout';
$t->is(sfConfig::get('symfony.view.default_index_layout'), $layoutPath, 'The sfConfig variables to change the layout were set correctly.');
// test the secure and error 404 layouts as well
$t->is(sfConfig::get('symfony.view.default_error404_layout'), $layoutPath, 'Layout also set on the error404 module/action');
$t->is(sfConfig::get('symfony.view.default_secure_layout'), $layoutPath, 'Layout also set on the secure module/action');
$t->is($context->getResponse()->getStylesheets(), array('main' => array()), 'The stylesheets were set correctly on the response');
$t->is($context->getResponse()->getJavascripts(), array('main.js' => array()), 'The javascripts were set correctly on the response');
$t->info('  2.4 - Check that trying to make the theme current again does nothing');
$t->info('  2.4.1 - Remove a stylesheet from the theme, see that it was not put back');
// This isn't something we'd normally do, just a clever way to see what's going on behind the scenes.
$context->getResponse()->removeStylesheet('main');
/*
 * To test, we need to "fake" switching outside of the test environment