0

我在 win 7 中使用 wamp 2.2 并尝试安装 phpunit

1.我从https://github.com/sebastianbergmann/phpunit下载 phpunit-master.zip 。2.我解压。3.我把它放在D:\wamp\bin\php\php5.3.10下,然后,我在php脚本下面运行;

<?php
//testsuite.wordcount.php
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once "PHPUnit/Framework/TestSuite.php";
require_once "class.testwordcount.php";
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTestSuite("TestWordCount");
PHPUnit_TextUI_TestRunner::run($suite);
?>

输出为: *Warning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\oop\test.php on line 4*

看来我没有正确安装phpunit,所以可能出了什么问题?

4

2 回答 2

4
Run the following commands (they may take a while to update):

pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels   

 To install PHPUnit, run
    pear install --alldeps --force phpunit/PHPUnit

    To test that PHPUnit was successfully installed, run
    phpunit -v
于 2013-04-22T05:15:08.053 回答
0

您不能只是将文件放在那里并希望它能够正常工作,您需要按照此处的安装说明进行操作:https ://github.com/sebastianbergmann/phpunit#installation

对我来说,我发现安装它的最简单方法是通过 Pear,如果您愿意在系统范围内安装它,尽管这可能会因升级、不同版本等或基于每个项目而变得混乱可以通过作曲家安装(这是我的偏好)

于 2013-04-22T05:16:40.527 回答