CakePHP的核心测试不工作的IIS [英] CakePHP core tests not working on IIS
问题描述
我在下面的步骤(从 HTTP://book.cakephp。组织/ 2.0 / EN /开发/ testing.html )设立测试在CakePHP的安装。
I'm following the steps (from http://book.cakephp.org/2.0/en/development/testing.html) to set up Testing on a CakePHP install.
查看核心试验被认为是为追加/test.php到我的应用程序的URL一样简单。但是,当我这样做,我得到一个错误页面,说...
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...
缺少控制器
错误:Test.phpController找不到
Error: Test.phpController could not be found.
错误:创建以下文件类Test.phpController:
我的应用\\控制器\\ Test.phpController.php
Error: Create the class Test.phpController below in file: my-app\Controller\Test.phpController.php
显然,test.php的应该是一个真正的文件,而不是控制器的名称,所以我想无论是我的IIS重写可能不正确,或在test.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.
(顺便说一句,我的应用程序的工作原理pretty很好,但我并没有从头开始安装 - 一个同事创建的应用程序一开始,所以我不能发誓,所有的默认设置,因为他们会上一个不折不扣的现成CakePHP安装。)
(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.)
推荐答案
我的问题的解决方法是双重的。首先,而非追加 test.php的
,我不得不追加根目录/ test.php的
。然后,我不得不取消从CakePHP的<一个导入规则3 href=\"http://book.cakephp.org/2.0/en/installation/url-rewriting.html#url-rewrites-on-iis7-windows-hosts\"相对=nofollow> URL重写IIS7上。这条规则说:
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}" />
我不知道为什么会重写规则被列入,但它似乎没有必要,而且美元的工作p $ pvents test.php的。
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.
这篇关于CakePHP的核心测试不工作的IIS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!