PHP - 是否有PHPUnit的可移植版本?

Joh*_*man 8 php phpunit

是否有可以与我的Web应用程序捆绑的PHPUnit的可移植版本?我希望能够在任何服务器上使用phpunit,同时避免使用PEAR(版本冲突,破坏其他托管应用程序等)的问题.

edo*_*ian 8

便携式phpunit(摘自https://github.com/sebastianbergmann/phpunit "使用Git Checkout中的PHPUnit")

对于phpunit 3.5:

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 phpunit && git checkout 3.5 && cd ..
cd dbunit && git checkout 1.0 && cd ..
cd php-file-iterator && git checkout 1.2 && cd ..
cd php-code-coverage && git checkout 1.0 && cd ..
cd php-token-stream && git checkout 1.0 && cd ..
cd phpunit-mock-objects && git checkout 1.0 && cd ..
cd phpunit-selenium && git checkout 1.0 && cd ..
Run Code Online (Sandbox Code Playgroud)

然后将每个文件夹放入包含路径中.

如果您遗漏任何一个包,它将无法工作.

如果你不想总是在include路径中有它们,那么这是一个phpunit.sh可执行文件

phpunit.sh

x='./checkoutDir/';

php -d include_path=".:$x/phpunit/:$x/dbunit/:$x/php-code-coverage/:$x/php-file-iterator/:$x/php-text-template/:$x/php-timer/:$x/php-token-stream/:$x/phpunit-mock-objects/:$x/phpunit-selenium/:$x/phpunit-story/:/usr/share/php/"  $x/phpunit/phpunit.php $*
Run Code Online (Sandbox Code Playgroud)