NetBeans IDE and Yii projects

You are viewing revision #12 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version or see the changes made in this revision.

« previous (#11)next (#13) »

This page is created to supply short directions and general tips for managing a Yii application in NetBeans IDE.

Testing

To run functional tests and unit tests in Yii, recommended is installing PHPUnit and SeleniumRC.

  • Install PHPUnit
  • Install SeleniumRC by getting the NetBeans plugin
    • Open "Tools > Plugins > Available Plugins"
    • Install "Selenium Module for PHP"
  • Configure project options
    • Open "File > Project properties > Sources" and set "Test Folder" to [PROJECT ROOT]/protected/tests (If the whole project testing doesn't work, try [PROJECT ROOT]/protected/tests/unit)
    • Open "File > Project properties > PHPUnit" and set "Use Bootstrap" to [PROJECT ROOT]/protected/tests/bootstrap.php, and "Use XML Configuration" to [PROJECT ROOT]/protected/tests/phpunit.xml
Usage:
  • Test whole project: Alt+F6
  • Test single file: Shift-F6
  • Check code coverage (right click project > Code Coverage)

Code completion

To get context sensitive code completion, follow these steps:

  • Include Yii folder (outside project directory)
    • Open "File > Project properties > PHP Include Path" and add the Yii framework root path
  • Ignore yiilite.php to avoid doubled/missing documentation
    • Open "Tools > Options > Miscellaneous > Files"
    • Add to the front of "Files Ignored by the IDE" the file "^(yiilite\.php|CVS|SCCS|...."
    • Restart NetBeans

For above and many more reasons, Yii core files should be kept outside project directory and anywhere outside any web-accessible directory. I.e. if you keep your project files in Apache's httpd directory, it is wise to create a new dir (called yii, framewore or sth. like that) in the same level of dirtree (inside Apache main folder, not in httpd dir!) and put Yii core files there. If you do that, you have to include Yii folder in Include Path, as it is written above.

Usage:
  • Typing suggestions: Ctrl-Space
  • Show Function parameters: Ctrl-P
  • Comment your own code with PHPDoc style. Here's a good example.

Debugging

  • Include the Xdebug extension for PHP (should already be available):
    • In php.ini enable (remove trailing comment semicolon sign - ;) these settings:
      zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
         xdebug.remote_enable = 1
         xdebug.remote_handler = "dbgp"
         xdebug.remote_host = "localhost"
         xdebug.remote_port = 9000
Usage:
  • Debug project: Ctrl-F5
  • Use breakpoints, walk through running code, and watch variables and objects in real-time. :)

Test Driven Design with Netbeans

  1. Testing
  2. Code completion
  3. Debugging

Check the forum here: http://www.yiiframework.com/forum/index.php?/topic/11735-netbeans-ide-and-test-driven-development/

65 0
66 followers
Viewed: 252 031 times
Version: Unknown (update)
Category: Tutorials
Written by: marcovtwout
Last updated by: marcovtwout
Created on: Sep 21, 2010
Last updated: 9 years ago
Update Article

Revisions

View all history

Related Articles