问题
I would like to statically get a count of number of tests in a directory. Is there something available that I can use? Phpunit seems to have a count before test runs say 0/100 and increments it as the test completes. I would like to fetch that number before hand and exit the run possibly.
回答1:
The --count-tests
option of phploc can give you, just like the grep
/ wc -l
line shown above, an estimate of the number of tests. Due to data providers, for instance, there cannot be an exact number without actually executing the tests.
来源:https://stackoverflow.com/questions/30905363/phpunit-how-to-get-the-count-of-tests-in-a-test-directory-without-running-test