简体   繁体   English

我如何运行phpunit测试?

[英]how do i run phpunit tests?

https://github.com/phpseclib/phpseclib/tree/master/tests https://github.com/phpseclib/phpseclib/tree/master/tests

My familiarity with phpunit is pretty lacking. 我对phpunit的了解非常缺乏。 How do I run those tests? 如何运行这些测试? I installed phpunit using the following commands (per this website ): 我使用以下命令(通过该网站 )安装了phpunit:

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

I try doing phpunit MD5Test from the tests/Crypt/Hash directory and get the following: 我尝试从tests / Crypt / Hash目录执行phpunit MD5Test并获得以下信息:

PHP Fatal error:  Class 'Crypt_Hash_TestCase' not found in /root/phpseclib/trunk/tests/Crypt/Hash/MD5Test.php on line 9

That's not too surprising since Crypt_Hash_TestCase isn't included anywhere. 这并不奇怪,因为Crypt_Hash_TestCase不在任何地方。 There's a bootstrap.php file but I don't know how to use that either. 有一个bootstrap.php文件,但我也不知道如何使用它。

Run phpunit from this directory: https://github.com/phpseclib/phpseclib The clue is that that is where the the phpunit.xml.dist file is found. 从以下目录运行phpunit: https : //github.com/phpseclib/phpseclib线索是可以找到phpunit.xml.dist文件。

To run all tests you start it with simply: 要运行所有测试,只需简单地启动它:

phpunit

If you just want to run the MD5Test tests then (still from that same root directory): 如果您只想运行MD5Test测试,则仍然从同一根目录运行:

phpunit tests/Crypt/Hash/MD5Test.php

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

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