简体   繁体   English

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

[英]How to use this File PHPunit test “extend PHPUnit_Framework_TestCase”

This is FIle Test it require PHPunit and i installed PHPunit , but dont know use it: 这是文件测试,它需要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{
    ........
    }
    ?>

it guide : 它指导:

When installed ( PHPunit) just run the command phpunit on the top of the directory and it will launch the tests. 安装后(PHPunit),只需在目录顶部运行phpunit命令,它将启动测试。

But i dont understand how do >< 但是我不明白怎么做> <

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. PHPUnit要求根据特定的命名约定对所有运行的测试用例进行命名。

I can't recall off the top of my head, but I think it's testAuthentication 我想不起来了,但我认为是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 EDIT1:尝试命名AuthenticationTest类,并在其中放入一个名为testAuthentication的函数

that should meet with PHPUnit's requirements to run your tests 应该符合PHPUnit运行测试的要求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM