uoz 作業日記

様々な作業の記録を共有するブログです。

Intellij Ideaでcakehp3のphpunitを動かす

webstormとかphpstormとか全部一緒だと思う。

下のstackoverflowに書いてあるやつの翻訳です.

1. Intellij の設定画面を開く

2. Languages & Frameworks > PHP を開く

3. Interpreter: でphpの実行ファイルを選ぶ
例えばosxMAMPだと
/Applications/MAMP/bin/php/php5.6.25/bin/php
とか

4. PHPUnitを選ぶ

5. PHPUnit Library 欄で、User Composer autoloaderを選んで、下の「Path to script」の右の欄にアプリディレクトリ内 vendor/autoload.phpへのパスを入れる

6. Test Runner 欄 で、「 Default configuration file」にチェックし、右のボックスに phpunit.xml.distのパスを入れる

!全部のパスは絶対パス


How to configure PhpStorm 10.x to run unit tests in CakePHP 3.x? - Stack Overflow

Without trying to solve your specific error, here's how I have configured PhpStorm.

In Languages & Frameworks > PHP

> Interpreter: Pointing to a local PHP executable
> PHPUnit > PHPUnit Library: Checked Use custom autoloader, pointing to vendor/autoload.php in the app folder.
> PHPUnit > Test Runner: Checked Default configuration file, pointing to phpunit.xml.dist in the app folder.

All paths should be absolute ones!

And that's all, running tests via the file/folder/code context menus Run ... command works just fine.