PHPUnit PHPUnit_GUI_SetupDecorator
PEARのPHPUnitにGUI/SetupDecorator.phpというファイルがある。それを使うとブラウザでテスト一覧を表示して、そこからテストを実行したりすることができる。
$gui = new PHPUnit_GUI_SetupDecorator(new PHPUnit_GUI_HTML()); $gui->getSuitesFromDir( '/path/to/dir/tests', // テストのPHPファイルの格納先 '.*\.php$', // テストするPHPファイル(正規表現で指定できる) array('index.php','sql.php')); // 除外するファイル $gui->show();
そのソースのコメントに
* Given that the path (the first parameter) ends with 'tests' it will be assumed * that the classes are named tests_* where * is the directory plus the filename, * according to PEAR standards.
とあって、ディレクトリ名が tests だったら、テストするクラス名は tests_* にすると書いてあった。PEARの規約(?)に従っていると書いてあるけど、PEARのCoding standardsにはそういう記述は見つけられなかった。どこかに何か定義されているのだろうか。
何か命名規則があるならそれに揃えたいけど。
- PEAR hacks ◇ PHPUnitの使い方 (3):PHPUnit_GUI_SetupDecoratorを使う
http://www.aglabo.com/agl/proevo/PHP/PEAR/phpunit-gui.html