1

如果您按照 F3 站点上的建议设置单元测试,它会失败。该示例将引导您创建一个带有 F3 测试的文件,并说明将其作为 test.php 保存在根目录中。所以网址是http://localhost/test.php. 好吧...这永远不会起作用,因为路由器会阻塞它。我把它放在哪里?我会在路由器 index.php 文件中放什么?也许我现在很累或者只是愚蠢,但我不知道如何运行这个 test.php 文件。

非常感谢你的帮助。

4

1 回答 1

1

I recommend to check out the dev branch of F3.

https://github.com/bcosca/fatfree/tree/dev

It consists of the latest code and a whole bunch of unit tests (see the app folder). The thing about the docs is: they're not 100% up to date and the example about unit tests doesn't work with routes. It's just pure PHP to test your app's functions by calling the test.php which tests the code of hello.php

If your router really tries to look for test.php in its routes, then you have to fix your rewrite rules, because you missed to exclude existing files and folders. Here's the snippet for Apache.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
于 2013-07-18T06:09:38.107 回答