Comment puis-je obtenir phpunit pour exécuter les tests de tous les fichiers dans un dossier?

De ce que j'ai lu, il me semble que je devrais être en mesure de mettre en place un dossier, par exemple les tests/, mettre quelques fichiers avec l'unité de classes de test, puis exécutez phpunit sur ce fichier et de trouver et d'exécuter les tests.

Pour quelque raison que ce soit, dans mon installation (sous OS X), il pense que le dossier de tests/est un fichier, ou de façon à ce qu'il semble:

$ ls tests
test1.php test2.php
$ phpunit tests/test1.php
PHPUnit 3.5.3 by Sebastian Bergmann.

F

Time: 0 seconds, Memory: 5.00Mb

There was 1 failure:

1) FailingTest::testFail
Your test successfully failed!

/Users/****/tmp/tests/test1.php:4

FAILURES!
Tests: 1, Assertions: 0, Failures: 1.
$ phpunit tests/test2.php
PHPUnit 3.5.3 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 5.00Mb

OK (1 test, 1 assertion)
$ phpunit tests
PHP Fatal error:  Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "tests.php" nor "tests.php" could be opened.' in /usr/local/PEAR/PHPUnit/Util/Skeleton/Test.php:102
Stack trace:
#0 /usr/local/PEAR/PHPUnit/TextUI/Command.php(157): PHPUnit_Util_Skeleton_Test->__construct('tests', '')
#1 /usr/local/PEAR/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#2 /usr/local/bin/phpunit(53): PHPUnit_TextUI_Command::main()
#3 {main}
  thrown in /usr/local/PEAR/PHPUnit/Util/Skeleton/Test.php on line 102

Fatal error: Uncaught exception 'PHPUnit_Framework_Exception' with message 'Neither "tests.php" nor "tests.php" could be opened.' in /usr/local/PEAR/PHPUnit/Util/Skeleton/Test.php:102
Stack trace:
#0 /usr/local/PEAR/PHPUnit/TextUI/Command.php(157): PHPUnit_Util_Skeleton_Test->__construct('tests', '')
#1 /usr/local/PEAR/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#2 /usr/local/bin/phpunit(53): PHPUnit_TextUI_Command::main()
#3 {main}
  thrown in /usr/local/PEAR/PHPUnit/Util/Skeleton/Test.php on line 102

J'ai ce que j'espère, c'est assez standard d'installation de phpunit par de la POIRE, à la suite de ces instructions http://www.newmediacampaigns.com/page/install-pear-phpunit-xdebug-on-macosx-snow-leopard, sur OS X Snow Leopard.

$ pear version
PEAR Version: 1.9.1
PHP Version: 5.3.2
Zend Engine Version: 2.3.0
Running on: **** 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
$ phpunit --version
PHPUnit 3.5.3 by Sebastian Bergmann.

J'espère que quelqu'un d'autre a couru dans ce dossier, et c'est juste un simple correctif, ou bien je suis juste fait quelque chose de mal?

  • Merci, mais j'ai tout compris (voir ma réponse). Puisque vous me lie à l'issue tracker, je vais déposer un billet pour voir s'ils vont mettre à jour leur documentation.
InformationsquelleAutor jsdalton | 2010-10-28