19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacにPear, PHPUnitをインストールする

Posted at

phpunitコマンドを叩いても「requireできないぜ!」ってエラーが消えなくてハマった。

PHP Warning:  require_once(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /vagrant/public/local.dev/BFB_tool/cup_result/tests/CalculatorTest.php on line 2

調べてみるとPHPUnit自体はMacにインストールされているがPearはインストールされていなかった。
あと、ファイルの最初にPHPUnitをrequireしなくてよかった。

MacにPearをインストールする

$ cd /tmp && mkdir pear && cd pear
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

#最後にphp.iniに設定書く?って文言が出るので「Y」
# Would you like to alter php.ini </private/etc/php.ini>? [Y/n] : Y

MacにPHPUnitをインストールする

$ sudo pear channel-discover pear.phpunit.de
$ sudo pear channel-discover components.ez.no
$ sudo pear channel-discover pear.symfony-project.com
$ sudo pear install phpunit/PHPUnit

##参考
[Mac] PEAR と PHPUnit のインストール方法

19
17
2

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
19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?