Miheretab Alemu
Miheretab Alemu

Reputation: 976

Can we customize CakePHP test page?

In http://book.cakephp.org/2.0/en/development/testing.html, says we can see tests using http://localhost/your_app/test.php page. Can we customize the appearance (css, layout) CakePHP test page? I know it is found in TestSuite/Templates folder but Is there a way to override it?

Please anyone help!

Thanks

Upvotes: 0

Views: 222

Answers (1)

ndm
ndm

Reputation: 60473

The paths to the layout files (lib/Cake/TestSuite/templates) used are hard coded in the so called "reporter" used by the test suite, see the paint*() methods CakeHtmlReporter.

It is however possible to hook in a custom reporter, by creating an appropriate reporter class named HtmlReporter in app/TestSuite/Reporter, ie app/TestSuite/Reporter/HtmlReporter.php

If present, the test suite will use this over the Cake HTML reporter. So you could simply extend the Cake HTML reporter, and override the paint*() methods so that they make use your custom templates.

If you'd want to use custom phpunit.php, xdebug.php and missing_configuration.php templates too, then you'd also have to use a custom test suite dispatcher, see CakeTestSuiteDispatcher. The build in dispatcher can easibly be exchanged for a custom one in your app/webroot/test.php file.

Upvotes: 4

Related Questions