7

PEAR のインストールに問題がありますが、本当は PHPUnit だけをインストールしたいのです。誰もこれを行った経験がありますか?

4

5 に答える 5

8

GIT経由でインストール

Git README の指示に従うことができます: https://github.com/sebastianbergmann/phpunit/

ファイルを「git」して、ホームディレクトリにドロップします

cd ~ && mkdir phpunit && cd phpunit
git clone git://github.com/sebastianbergmann/phpunit.git
git clone git://github.com/sebastianbergmann/dbunit.git
git clone git://github.com/sebastianbergmann/php-file-iterator.git
git clone git://github.com/sebastianbergmann/php-text-template.git
git clone git://github.com/sebastianbergmann/php-code-coverage.git
git clone git://github.com/sebastianbergmann/php-token-stream.git
git clone git://github.com/sebastianbergmann/php-timer.git
git clone git://github.com/sebastianbergmann/phpunit-mock-objects.git
git clone git://github.com/sebastianbergmann/phpunit-selenium.git

個人のバイナリ パスを設定する

cd ~ && mkdir bin
vi ~/.profile
>> export PATH=$HOME/bin:$PATH
>> :wq
source ~/.profile

実行可能ファイルを作成する

touch ~/bin/phpunit
chmod 755 ~/bin/phpunit

実行可能ファイルを書く

#!/usr/bin/env php
<?php

// set main method
define('PHPUnit_MAIN_METHOD','PHPUnit_TextUI_Command::main');

// add phpunit to the include path
$paths = scandir($_ENV['HOME'].'/phpunit');
$includes = array();
foreach($paths as $path){
    if (!preg_match('/^\./', $path)){
        $includes[] = $_ENV['HOME'].'/phpunit/' . $path;
    }
}
set_include_path(implode(PATH_SEPARATOR,$includes).PATH_SEPARATOR.get_include_path());

// set the auto loader
require 'PHPUnit/Autoload.php';

// execute
PHPUnit_TextUI_Command::main();

実行可能ファイルをテストする

which phpunit
phpunit --version
于 2011-08-09T18:30:19.193 に答える
4

PHPUnitインストールガイドから:

PHPUnit をインストールする唯一のサポートされている方法は PEAR インストーラを使用することですが、PHPUnit を手動でインストールすることもできます。手動インストールの場合は、次の手順を実行します。

  1. http://pear.phpunit.de/get/からリリース アーカイブをダウンロードし、php.ini 構成ファイルの include_path にリストされているディレクトリに展開します。
  2. phpunit スクリプトを準備します。
    1. phpunit.php スクリプトの名前を phpunit に変更します。
    2. その中の @php_bin@ 文字列を PHP コマンドライン インタープリターへのパス (通常は /usr/bin/php) に置き換えます。
    3. これをパス内のディレクトリにコピーし、実行可能にします (chmod +x phpunit)。
  3. PHPUnit/Util/Fileloader.php スクリプトを準備します。
    1. その中の @php_bin@ 文字列を PHP コマンドライン インタープリターへのパス (通常は /usr/bin/php) に置き換えます。
于 2009-03-10T08:55:58.417 に答える
0

私は最近、pearを使用せずに現在(ほとんど)機能するphpunitのgithubフォークを作成しました。それはあなたのために働くかもしれません。

于 2011-06-27T00:19:07.193 に答える
0

今日取り付けたばかりです。私の手順は次のとおりです。

  • /get/ からダウンロード - 3.3.9.tgz を使用しました
  • すべてのファイルを pear ディレクトリ (pear-phpunit、PHPUnit/ など...) に抽出します。
  • 上記のファイルで @php_bin@ を変更して、私の php バイナリ (/usr/bin/php) を指すようにします。
  • pear-phpunit から /usr/local/bin/phpunit へのシンボリックリンクを作成します ( ln -s /usr/share/php/pear/pear-phpunit /usr/local/bin/phpunit)
于 2009-08-18T18:31:15.920 に答える
0

アンドリュー、私は現在 PHPUnit のインストールに取り組んでいます。php.ini の include_path を更新した後に Web サーバーを再起動すると、非常に役立つことがわかりました。PHPコマンドラインインタープリターの正確な場所を探しています(それが私がここにたどり着いた方法です)。随時お知らせします。

サビーネ

于 2009-05-13T12:47:31.110 に答える