puco

module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2025 License: BSD-2-Clause

README

💊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.

With this tool,

  1. Select test files to run,
  2. Select files for which you want to generate coverage reports (HTML),
  3. 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: 英語もほしい

  1. 選択されたテストファイルのパスを取得(複数可)
  2. 選択されたカバレッジレポートを生成したいファイルのパスを取得(複数可)
  3. 2の最長一致のパス(ディレクトリパス)を計算
    • ※このディレクトリパスの配下がカバレッジ生成の対象なので、2で選択された各ファイルパスのみがカバレッジ生成対象ではないことに注意
  4. 1と3と既存のphpunit.xmlがあれば、それらを元にphpunitxml_generated_by_puco.xmlを生成
  5. 実行するphpコマンドを組み立て、実行する
  6. coverage-pucoディレクトリ配下にカバレッジレポートが生成される

[!WARNING] ※puco初回実行時に、~/.config/puco.tomlという設定ファイルができます。 この設定ファイル内のキー:CommandToSpecifyBeforePHPCommandにdockerコマンド越しにphpコマンドを実行するよう記載していますが、直接phpコマンドを実行したい場合は、このキーの値を""にしていただくか、この行ごと消してください。

TODO

  • カバレッジレポートをHTML形式以外でも出力できるようにする
  • ヒストリー機能欲しい
    • 何度もファイル選択は手間。ただ、ツールで組み立てられたコマンドは表示されるので、それコピペで実行でも代替できるから後でいいかも
    • 一旦repeatフラグを実装したから、ほんとに欲しくなってからでいいかも

Directories

Path Synopsis
cmd
puco command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL