2011-11-13 20 views
3

インストールPEARにPEARのパスを含めると続く。その後セットアップが<a href="http://www.phpunit.de/manual/current/en/installation.html" rel="nofollow">http://www.phpunit.de/manual/current/en/installation.html</a>上方向WAMPを

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

を、私はテストを作成しました:

<?php 
# error reporting 
ini_set('display_errors',1); 
error_reporting(E_ALL|E_STRICT); 

# include TestRunner 
require_once 'PHPUnit/TextUI/TestRunner.php'; 

# our test class 
class ExampleTest extends PHPUnit_Framework_TestCase 
{ 
    public function testOne() 
    { 
     $this->assertTrue(FALSE); 
    } 
} 

# run the test 
$suite = new PHPUnit_Framework_TestSuite('ExampleTest'); 
PHPUnit_TextUI_TestRunner::run($suite); 
?> 

は私が含まphp.iniファイルに以下のとApacheの再起動:

include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8" 
include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear" 
include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear/PHPUnit" 

私はWarning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in ...

を取得

インクルードパスが機能しないのはなぜですか? Program filesにスペースがあるからでしょうか?

Windows XPとWAMPで作業しています。

EDIT:提案通りにパスを更新しました。

のrequire_onceコールの前echo ini_get('include_path');の出力がされています。また、require_onceをコマンドを削除すると、最後の1がすべてを上書きします、iniファイルにこれらの3つの行を追加することによりFatal error: Class 'PHPUnit_Framework_TestCase' not found in...

+0

あなたは正確にあなたのrequire_onceの前にパスを含める 'のPHPUnit/TextUIの/ TestRunner.php' を印刷することができますか? エコーini_get( 'include_path');おそらく何かがそれを上書きしています –

+0

のサイドノートPHPUnitのファイルをテストケースに手動で入れる必要はありません。コマンドラインからPHPUnitを実行すると、独自のオートローダーが登録されます。 PEARがinclude_pathにあることを確認する必要があります。 – Gordon

+0

実際に、私はそれらの「How Do I」の投稿に相談しました。彼らはインストールのための多くの異なる指示を持っていますが、問題を解決しませんでした。 –

答えて

2

をスロー

.;C:\Program Files/wamp/bin/php/php5.3.8/pear 

。この1つだけを使用してください。

include_path = ".;C:\Program Files\wamp\bin\php\php5.3.8\pear" 

編集:@Gordonコメントを追加してください。我々は\pearを維持する必要があります。内側の梨の図書館はすでに梨が含まれていると仮定しているからです。

http://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini

+0

1?なぜか 'include_path ="; C:\ Program Files \ wamp \ bin \ php \ php5.3.8'? –

+1

@BSevenはhttp://pear.php.net/manual/ja/installation.checking.php#installationなので.checking.cli.modifyingphpini;) – Gordon