如何使用此文件 PHPunit 测试“扩展 PHPUnit_Framework_TestCase”

发布于 2024-10-03 22:16:16 字数 444 浏览 0 评论 0原文

这是文件测试,它需要 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑,眼淚并存 2024-10-10 22:16:16

您在这里还有很多问题没有得到解答。 但是马上,我发现您的 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 called testAuthentication

that should meet with PHPUnit's requirements to run your tests

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文