views:

89

answers:

1

Hi!

I have a directoy structure, and all the classes of the business logic are placed in the app_dir/lib/ directory. I would like to generate unit tests for all the classes from this lib/ folder.

The problem is, that I haven't found any option to specify the source directory, only the source file:

from app_dir:

phpunit --skeleton-class lib/

Error: "lib/.php" could not be opened.

Is it the only solution to write my own php script, which iterates through the /lib folder and calls the skeleton generator for every file found? And how can I specify the output folder, where all the generated test files are placed?

Thanx, Joe

A: 

From Sebastian Bergmann's blog:

As of changeset 2764, PHPUnit 3.3's command-line test runner accepts a directory as its argument.

Given a directory, the test runner will recursively scan the directory for *Test.php files, build a test suite out of the *Test classes, and run it.

With PHPUnit >= 3.3 you should be able to execute just:

phpunit lib
nuqqsa