如何使用此文件 PHPunit 测试“扩展 PHPUnit_Framework_TestCase”
这是文件测试,它需要 PHPunit 并且我安装了 PHPunit ,但不知道使用它:
<?php
# -*- compile-command: (concat "phpunit " buffer-file-name) -*-
require_once 'PHPUnit/Framework.php';
require_once 'common.php';
class Authentication extends PHPUnit_Framework_TestCase{
........
}
?>
它指南:
安装后(PHPunit)只需运行 命令 phpunit 在顶部 目录,它将启动 测试。
但我不明白怎么做><
This is FIle Test it require PHPunit and i installed PHPunit , but dont know use it:
<?php
# -*- compile-command: (concat "phpunit " buffer-file-name) -*-
require_once 'PHPUnit/Framework.php';
require_once 'common.php';
class Authentication extends PHPUnit_Framework_TestCase{
........
}
?>
it guide :
When installed ( PHPunit) just run the
command phpunit on the top of the
directory and it will launch the
tests.
But i dont understand how do ><
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在这里还有很多问题没有得到解答。 但是马上,我发现您的 Authentication 类的名称有问题。
PHPUnit 要求任何运行的测试用例都根据特定的命名约定进行命名。
我记不清了,但我认为这是 testAuthentication
我会研究一些代码并回复您。
编辑1:
尝试将类命名为
AuthenticationTest
并在其中放置一个名为testAuthentication
的函数,该函数应满足 PHPUnit 运行测试的要求
There are a lot of questions you've left unanswered here. BUT right off the bat, I see that you've got a problem with the name of the Authentication class.
PHPUnit requires that any testcases that are run be named according to a specific naming convention.
I can't recall off the top of my head, but I think it's testAuthentication
I'll look into some of my code and get back to you.
EDIT1:
try naming the class
AuthenticationTest
and put a function inside it calledtestAuthentication
that should meet with PHPUnit's requirements to run your tests