duanjiao5723 2012-08-20 20:32
浏览 95
已采纳

我如何运行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.

  • 写回答

1条回答 默认 最新

  • doudengjin8251 2012-08-21 00:10
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?