How do I run all my PHPUnit tests?

Solution 1:

Php test's filename must end with Test.php

phpunit mydir will run all scripts named xxxxTest.php in directory mydir

(looks likes it's not described in the phpunit documentation)

Solution 2:

I created following phpunit.xml and now atleast I can do phpunit --configuration phpunit.xml in my root directory to run the tests located in Tests/

<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         syntaxCheck="false">
  <testsuites>
    <testsuite name="Tests">
      <directory suffix=".php">Tests</directory>
    </testsuite>
  </testsuites>
</phpunit>

Solution 3:

I think forPHPUnit to decide to automatically run it it must follow a filename convention: somethingTest.php.

Solution 4:

You think they would have documented this. I just looked through the manual, and they say you can pass a directory, but not really how to do it.

Perhaps your class name has to match the basename (everything but the ".php") of your test scripts filename?