PHP-有PHPUnit的可移植版本吗?
是否有一个可移植版本的PHPUnit可以与我的web应用捆绑在一起?我希望能够在任何服务器上使用phpunit,同时避免使用PEAR(版本冲突、破坏其他托管应用程序等)的问题。便携式phpunit(摘自“从Git签出使用phpunit”) 对于phpunit 3.5:PHP-有PHPUnit的可移植版本吗?,php,phpunit,Php,Phpunit,是否有一个可移植版本的PHPUnit可以与我的web应用捆绑在一起?我希望能够在任何服务器上使用phpunit,同时避免使用PEAR(版本冲突、破坏其他托管应用程序等)的问题。便携式phpunit(摘自“从Git签出使用phpunit”) 对于phpunit 3.5: git clone git://github.com/sebastianbergmann/phpunit.git git clone git://github.com/sebastianbergmann/dbunit.git gi
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 ..
然后将这些文件夹中的每一个放入您的include路径
如果你遗漏了其中的任何一个包,它将不起作用
如果您不想总是将它们包含在include路径中,这里有一个phpunit.sh可执行文件
phpunit.sh
来自edorian的回答遗漏了Symfony/Yaml包。此外,Symfony/Finder似乎是必需的,尽管PHPUnit的自述文件中没有提到 关于PEAR依赖性,只有PHPUnit的自我测试才需要它。至少我已经成功地运行了Zend Framework 2的整个测试套件,没有任何问题。而且我没有安装梨 这是我制作的PHPUnit-Git签出的安装程序。在编写时(今天可能仍然有用)。然而,现在有一些更方便的选择供您选择 除此之外,您还可以下载PHPUnit作为Phar并使用它 引用 我们发布了一个PHP归档(PHAR),它将PHPUnit的所有必需(以及一些可选)依赖项捆绑在一个文件中:
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 $*
wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit