LoginSignup
0
0

More than 5 years have passed since last update.

windows、xampp、cakephp3.7のphpunitインストールではまった話

Last updated at Posted at 2018-12-17

windows、xampp、cakephp3.7のphpunitインストールではまった話

症状

cakephp3.7でunitテストをすると、エラーが発生して実行できない。

原因

phpunitの最新は7.5なのに、xamppのphpunitのバージョンが、3.*だ。
cakephp3はphpunit7.*に対応していない。
cakephp3.7は、5.*に対応していない?
コマンドでバージョン指定してもxamppのphpunitのバージョンが優先される。

解決方法

1.下記をダウンロード
https://phar.phpunit.de/phpunit-6.phar

2.ダウンロードファイルをxamppにコピー
xampp\php\ フォルダにphpunit-6.pharをコピーし、ファイル名をphpunit.pharに変更。

3.xampp\php\phpunit.batの編集
phpunit.batをエディタで開き、一番下の記述を変更。
▽修正前
"%PHPBIN%" "C:\xampp\php\phpunit" %*
▽修正後
"%PHPBIN%" "C:\xampp\php\phpunit.phar" %*

4.通常バージョンを指定してインストール
composer require --dev phpunit/phpunit
composer require --dev phpunit/phpunit:"^5.7|^6.0"

以上です。

下記を参考にしました。

https://qiita.com/mosaxiv/items/c714af921961bc898ec2
https://npg-web.com/2017/05/11/phpunit_install/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0