💊PuCo
Tool that aids PHPUnit and PCOV
Running tests takes a lot of time, and generating test coverage also takes a significant amount of time.
This tool might be useful in such situations.

[!IMPORTANT]
vendor/bin/phpunit and pcov are required.
- Select test files to run,
- Select files for which you want to generate coverage reports (HTML),
- You might be able to execute steps 1 and 2 easily and quickly. Probably. Probably..
Which test files can be selected?
Files located in tests/ directory.
Which files can be selected to get coverage?
Files located in src/ or app/ directory.
How to install?
Homebrew
brew install ddddddO/tap/puco
Go
go install github.com/ddddddO/puco/cmd/puco@latest
Usage
$ puco --help
Usage: puco [options]
puco
Options:
-repeat
This flag starts with data selected by the most recently executed puco.
Example:
puco # normal launch
puco --repeat # launch using the most recent data
$
Processing of PuCo
todo: 英語もほしい
- 選択されたテストファイルのパスを取得(複数可)
- 選択されたカバレッジレポートを生成したいファイルのパスを取得(複数可)
- 2の最長一致のパス(ディレクトリパス)を計算
- ※このディレクトリパスの配下がカバレッジ生成の対象なので、2で選択された各ファイルパスのみがカバレッジ生成対象ではないことに注意
- 1と3と既存の
phpunit.xmlがあれば、それらを元にphpunitxml_generated_by_puco.xmlを生成
- 実行する
phpコマンドを組み立て、実行する
coverage-pucoディレクトリ配下にカバレッジレポートが生成される
[!WARNING]
※puco初回実行時に、~/.config/puco.tomlという設定ファイルができます。
この設定ファイル内のキー:CommandToSpecifyBeforePHPCommandにdockerコマンド越しにphpコマンドを実行するよう記載していますが、直接phpコマンドを実行したい場合は、このキーの値を""にしていただくか、この行ごと消してください。
TODO
- カバレッジレポートをHTML形式以外でも出力できるようにする
- ヒストリー機能欲しい
- 何度もファイル選択は手間。ただ、ツールで組み立てられたコマンドは表示されるので、それコピペで実行でも代替できるから後でいいかも
- 一旦repeatフラグを実装したから、ほんとに欲しくなってからでいいかも