我正在尝试为树枝过滤器编写测试。为此,我需要从fixture文件夹加载一个主题
plugins/matchish/myplugin/tests/fixtures/themes/test
这是我如何设置测试
class TwigTest extends PluginTestCase {
public function setUp()
{
parent::setUp();
Config::set('cms.themesPath', __DIR__ . '/../fixtures/themes');
Config::set('cms.activeTheme', 'test');
Event::flush('cms.theme.getActiveTheme');
Theme::resetCache();
}
...
现在我收到错误active theme not found
你可以使用getActiveTheme
和setActiveTheme
// store old code once your testing done it should return to default theme
$oldTheme = Theme::getActiveTheme();
Theme::resetCache();
Theme::setActiveTheme('<theme.code>');
// at last
Theme::setActiveTheme($oldTheme);
可能这应该有所帮助。