经过多次搜索后,我编写了以下教程,希望对其他人有所帮助:
*** phpunit via PEAR: ***
----------------
SELENIUM FOR FUNCTION TESTING (not mendatory)
A. pear install --force phpunit/PHPUnit_Selenium
B. http://www.phpunit.de/manual/3.1/en/selenium.html
PHPUnit + Selenium: (http://amiworks.co.in/talk/installing-pear-and-phpunit-on-wamp-and-windows-7/)
A. pear upgrade pear
B. pear channel-discover components.ez.no
C. pear channel-discover pear.phpunit.de
D. pear channel-discover pear.symfony.com //+ pear channel-discover pear.symfony-project.com
E. pear install --alldeps pear.phpunit.de/PHPUnit
F. pear install phpunit/PHPUnit_SkeletonGenerator
G. pear install phpunit/PHPUnit_Selenium
In NETBEANS:
A. Tools --> Options --> PHP --> Unit Test --> Add PHPUnit + Skeleton
B. Right click on the project --> properties --> PHPUnit -->
B1. Browse to bootstrap + XML and Genereate to tests folder
B2. update the generated bootstrap with Yii (from original bootstrap)
*** UPDATE bootstrap: (PHPUnit >3.6):
add "require_once( Yii::getPathOfAlias('system.test.CTestCase').'.php' );" after "require_once($yiit);"
*** UPDATE Yii Framework CTestCase.php (PHPUnit >3.6):
require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Autoload.php');
*** In case of errors make sure php.ini under php folder is not missing configuration (should have the same as php.ini under Apache in WAMP)
问候,丹尼