问题
I'm following the steps (from http://book.cakephp.org/2.0/en/development/testing.html) to set up Testing on a CakePHP install.
Viewing the core tests is supposed to be as simple as appending /test.php to my application's URL. But when I do that, I get an error page, saying...
Missing Controller
Error: Test.phpController could not be found.
Error: Create the class Test.phpController below in file: my-app\Controller\Test.phpController.php
Obviously, "test.php" is supposed to be a real file, not the name of a controller, so I think either my IIS rewrites might be incorrect, or maybe some setting in test.php itself? I haven't found anything useful elsewhere on the Internet so I'm asking here.
(By the way, my app works pretty well, but I didn't install it from scratch -- a colleague created the app initially, so I can't swear that all the defaults are set as they would be on an out-of-the-box CakePHP installation.)
回答1:
The fix for my problem was twofold. First, rather than appending test.php
, I had to append webroot/test.php
. Then I had to deactivate "Imported Rule 3" from CakePHP's URL rewrites on IIS7. This rule says:
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/{R:1}" />
I am not sure why that rewrite rule was included, but it doesn't seem to be necessary, and it prevents test.php from working.
来源:https://stackoverflow.com/questions/16309260/cakephp-core-tests-not-working-on-iis