LoginSignup
15
16

More than 5 years have passed since last update.

PHPUnitをインストール

Posted at

環境はMAMP 2.1.2のphp 5.4.10です。
.bash_profileに次の1行を加えて、パスを通しておきます。

export PATH="/Applications/MAMP/bin/php/php5.4.10/bin:$PATH"

まずPEARのチャンネル(パッケージの参照元URL?)をアップデート。

$ pear update-channels

次にPEAR自身をアップグレード。

$ pear upgrade -a PEAR

続けてインストール済みのパッケージをアップグレード。

$ pear upgrade-all

そしてPHPUnitのインストール。
auto_discoverは新しいチャンネルを自動的に探すようにする設定らしい。

$ pear config-set auto_discover 1
$ pear install pear.phpunit.de/PHPUnit

エラーが出なければ、これでインストールは完了です。

とりあえず動かしてみたかったので、次のような適当なファイルを用意。

test.php
<?php

class Person_Test extends PHPUnit_Framework_TestCase
{
        public function test_function()
        {
                $this->assertTrue(TRUE);
        }
}

phpunitを実行してみます。

$ phpunit test.php
PHPUnit 3.7.18 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 2.50Mb

OK (1 test, 1 assertion)

おっけー。

15
16
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
15
16