PHPunit tests cases in Netbeans for an Yii web application

How to create PHPunit tests cases in Netbeans for an Yii web application

Environment

  Product Version: NetBeans IDE Dev (Build 200903111543)

  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 / PHP 5.2.4

  Yii framework 1.0.3

  PHPunit test 3.3.15

  1. Create a web application project with yiic tools (e.g. yii-1.0.3.r780\framework>yiic webapp …/…/testdrive2). Run the project to see that it works.

  2. Create a netbeans php project from the source code obtained (File>New Project>Categories:PHP>Projects: PHP Application with Existing Sources). Run the project to see that it works.

  3. Make sure that your Yii framework is added to your PHP Include Path

  4. Create a directory for your tests at the same level of protected directory.

  5. Copy, to your tests directory, these attached files TestApplication.php, TestWebApplication.php, yii.php.

  6. As SiteController.php extends CController, add to SiteController.php this line:

    require_once ‘yii.php’;
  7. Right clic SiteController.php and select Tools>Create PHPunit tests.

  8. Remove from SiteController.php this line added in Step 6 :

    require_once ‘yii.php’;
  9. In SiteControllerTest setUp(), comment as

    //$this->object = new SiteController;
    or change this line to
    $this->object = new SiteController(‘site’);
  10. Add this test

    testHello() {$this->assertEquals(‘Hello’, ‘Hello’);}
  11. Right click SiteController.php and select Test (or Ctrl+F6). that's all.

TestWebApplication.php

TestApplication.php

Unfortunately I am not able to download the files. Any possibility to fix it?

best regards and thx,

Bergtroll

I also cannot download the file.

someone help.

No funciona la descarga de ninguno de los tres archivos adjuntos, podrías volver a adjuntarlos.

Un saludo y gracias.

Ya no son necesarios. ¿Qué problemas tienes?

También puedes ver estas referencias:

http://www.yiiframework.com/forum/index.php?/topic/4717-netbeans-68-phpunit-and-yii/

http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

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

the links are broken…