如何使用phing運行帶bootstrap文件的PHPUnit測試套件?phing和phpunit + bootstrap
我的應用程序結構:
application/
library/
tests/
application/
library/
bootstrap.php
phpunit.xml
build.xml
phpunit.xml:
<phpunit bootstrap="./bootstrap.php" colors="true">
<testsuite name="Application Test Suite">
<directory>./</directory>
</testsuite>
<filter>
<whitelist>
<directory
suffix=".php">../library/</directory>
<directory
suffix=".php">../application/</directory>
<exclude>
<directory
suffix=".phtml">../application/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
則:
cd /path/to/app/tests/
phpunit
#all test passed
但是我怎麼運行從/path/to/app/
DIR測試?問題是,bootstrap.php
依賴於庫和應用程序的相對路徑。
如果我運行phpunit --configuration tests/phpunit.xml /tests
我收到了一堆找不到的文件錯誤。
我該如何編寫build.xml
文件phing
以與phpunit.xml
相同的方式運行測試?
感謝。這或多或少是我的'bootstrap.php'。我的問題是我不知道我可以用這種方式指定引導參數:'phpunit --bootstrap tests/bootstrap.php --configuration tests/phpunit.xml' – takeshin 2010-09-10 18:10:03
這對我來說很新鮮,感謝評論! – opHASnoNAME 2010-09-11 06:10:09