1

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.

4
  • phpunit.de/manual/3.7/en/index.html Commented Aug 20, 2012 at 20:49
  • So your proposal is that I spend days and days reading the manual, learning all about how to write unit tests and utilize such obscure functions as assertContainsOnly() when all I want to do is run a unit test? Gee... thanks. Commented Aug 20, 2012 at 21:05
  • Why not? I did, so did many others. You are allowed to read some of the manual, the bits about actually running unit tests may be useful. Commented Aug 20, 2012 at 21:12
  • Ok... phpunit.de/manual/3.7/en/textui.html That's the only example I found of running phpunit. I assume *.php is appended to ArrayTest but if so then what do the contents of ArrayTest.php look like? Commented Aug 20, 2012 at 21:18

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.