こちらのサイトを参考に使ってみる
1.インストールされているか確認して使ってみる
2.ログの場所
3.特定のテストだけ実行
1.インストールされているか確認
プロジェクトディレクトリで以下実行
$ vendor/bin/phpunit
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
.. 2 / 2 (100%)
Time: 1.63 seconds, Memory: 10.00MB
OK (2 tests, 2 assertions)
緑色でOKと出たら正常に完了
tests/Feature/とtests/Unit/のExampleTest.phpを実行しているらしい
もしコマンドが見つかりませんと出た場合はインストールされていないのでcomposer.jsonに以下のような記述を追記してcompose updateを実行すると良いっぽい(試してないのであしからず)
“require-dev”: {
“phpunit/phpunit”: “~5.7”
},
2.ログの場所
storage/logsに出るみたい
3.特定のテストだけ実行
以下のオプションを使うとできます
–filter
[vagrant@localhost git_my_shared]$ vendor/bin/phpunit –filter ‘ExampleTest’
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
.. 2 / 2 (100%)
Time: 3.69 seconds, Memory: 10.00MB
OK (2 tests, 2 assertions)
[vagrant@localhost git_my_shared]$
コメント