3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 860 Views |
-
[Solved] Templates for functional tests

28 July 2010 at 3:31am Last edited: 30 September 2010 3:38am
I have had problems when writing functional tests using Director::test()
Because the test made for a shared module needs to be independent of theme templates I want to force it to use a template in the module. But because theme templates overrides the module template my tests does not know what to expect.Did anyone face the same problem and come up with a solution?
-
Re: [Solved] Templates for functional tests

30 September 2010 at 3:37am
A collegue had this simple but brilliant idea when working on something entirely different.
By setting theme in SSViewer to null during test setup we force Director::test() to use eigther the template in the tested module or in mysite. Given that we're testing ajax or a pagetype of course.public function setUp() {
SSViewer::set_theme( null );
}public function tearDown() {
SSViewer::set_theme( SSViewer::current_custom_theme() );
}public function testTemplate() {
$responseByTemplateInModule = Director::test("/mypage");
}
| 860 Views | ||
|
Page:
1
|
Go to Top |

