$t = new lime_test(31); $t->info('1 - Test some basics of getting themes, theme objects'); // we'll use this to test the theme object $themeConfig = array('layout' => 'testing'); $theme = new sfTheme($themeConfig); $manager = new sfThemeManager($context); $t->is($manager->getThemes(), array(), '->getThemes() returns an empty array to start.'); $manager = new sfThemeManager($context, array('test_theme' => $themeConfig)); $t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via the constructor.'); $manager = new sfThemeManager($context); $manager->addTheme('test_theme', $themeConfig); $t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via addTheme() passing in an array.'); $t->is($manager->getThemeObject('test_theme')->getConfig(), $theme->getConfig(), '->getThemeObject() returns the correct theme object'); $manager = new sfThemeManager($context); $manager->addTheme('test_theme', $theme); $t->is($manager->getThemes(), array('test_theme' => $themeConfig), 'Themes can be set via addTheme() passing in an sfTheme object.'); $t->is($manager->getThemeObject('test_theme'), $theme, '->getThemeObject() returns the correct theme object'); $t->info(' 1.1 - Trying to retrieve a non-existent theme object throws an exception'); try { $manager->getThemeObject('fake'); $t->fail('No exception thrown'); } catch (sfException $e) { $t->pass($e->getMessage()); } $t->info(' 1.2 - Play with the current theme'); $t->is($manager->getCurrentTheme(), false, '->getCurrentTheme() returns false when there is no theme set'); $t->is($manager->getCurrentThemeObject(), false, '->getCurrentThemeObject() return false when there is no theme set'); $t->info('2 - Set some themes and see what happens'); $manager = new sfThemeManager($context); $themeConfig = array('layout' => 'app_test_layout', 'stylesheets' => array('main'), 'javascripts' => array('main.js')); $t->info(' 2.1 - Setting a non-existent theme as current throws an exception');