我如何运行phpunit测试?

问题描述:

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

My familiarity with phpunit is pretty lacking. How do I run those tests? I installed phpunit using the following commands (per this website):

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:

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. There's a bootstrap.php file but I don't know how to use that either.

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

我对phpunit的熟悉程度非常低。 我该如何运行这些测试? 我使用以下命令安装了phpunit(根据本网站): p>

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

我尝试 phpunit MD5Test code>并获得以下内容: p>

  PHP致命错误:/ root / phpseclib /中找不到类'Crypt_Hash_TestCase' 第9行上的trunk / tests / Crypt / Hash / MD5Test.php 
  code>  pre> 
 
 

由于Crypt_Hash_TestCase不包含在任何地方,所以这并不太令人惊讶。 有一个bootstrap.php文件,但我不知道如何使用它。 p> div>

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.

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):

phpunit tests/Crypt/Hash/MD5Test.php