Ref.:
http://www.yiiframew...ndpost&pid=6301
Environment:
Product Version: NetBeans IDE Dev (Build 200909221401)
Java: 1.6.0_10; Java HotSpot Client VM 11.0-b15
System: Windows XP version 5.1 running on x86; Cp1252; es_ES (nb)
Apache/2.2.6 (Win32) PHP/5.2.9-2
Yii framework 1.0.9
PHPUnit 3.3.15
1. Create a web application project with yiic tools (e.g. yiic webapp testdrive).
2. Create a netbeans php project from the source code obtained (File>New Project>Categories:PHP>Projects: PHP Application with Existing Sources).
3. Make sure that your Yii framework is added to your PHP Include Path
4. Create a directory for your tests under testdrive folder. You may want to use the Files tab.
5. Create a file in the tests folder. Name it bootstrap.php. Add the following code and save.
<?php require_once dirname(__FILE__).'/../../yii/1.0.9/framework/yii.php'; // make sure your path to yii.php is correct ?>
6. Right click testdrive project. Select Properties. Project Properties pops up. select PHPUnit then in the PHPUnit configuration activate Use Bootstrap and browse to your bootstrap.php file.
6. Right click Source Files under testdrive folder in the Projects tab and select Tools > create PHPUnits tests.
7. You may see some folders created for you contaning unit test skeleton. You may want tweak them to fit your needs.
Example
a. In SiteControllerTest setUp(), comment as
//$this->object = new SiteController;
or change this line to
$this->object = new SiteController('site');
b. Add this test
testHello() {$this->assertEquals('Hello', 'Hello');}
c. Right click SiteController.php and select Test (or Ctrl+F6).
Note: Netbeans 6.8 is now under Comunity Acceptance Testing process.

Help




















