我正在尝试为树枝过滤器编写测试。
为此,我需要从灯具文件夹中加载主题
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
答案 0 :(得分:0)
您可以使用class TabBarController: UITabBarController, UITabBarControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
// let sb = UIStoryboard(name: "Data", bundle: nil)
// let roomChooserVC = sb.instantiateViewController(withIdentifier: "roomchooser") as! RoomChooserController
// roomChooserVC.tabBarItem = UITabBarItem(tabBarSystemItem: .downloads, tag: 3)
// self.viewControllers?.append(roomChooserVC)
//
// ^^^^IF I ADD THE TAB IN VIEWDIDLOAD IT WORKS FINE ^^^
}
// If I call addNewTabBarItem() from another class, the methods get executed but the new tab is not shown ---
func addNewTabBarItem(){
let sb = UIStoryboard(name: "Data", bundle: nil)
let roomChooserVC = sb.instantiateViewController(withIdentifier: "roomchooser") as! RoomChooserController
roomChooserVC.tabBarItem = UITabBarItem(tabBarSystemItem: .downloads, tag: 3)
self.viewControllers?.append(roomChooserVC)
}
}
和let tbController = TabBarController()
override func viewDidLoad() {
super.viewDidLoad()
tbController.addNewTabBarItem()
// If I put a breakpoint in addNewTabBarItem everything's get
// executed fine
// MAYBE RELOAD VIEW OF TABBARCONTROLLER SOMEHOW?
}
getActiveTheme
这可能会有所帮助。