NetBeans IDE and Test Driven Development

Right click on project name -> Project Properties -> PHPUnit -> Set to use bootstrap file protected/tests/bootstrap.php.

PS. This may not work.

Now i have this:

Warning: require_once(D:\xampp\htdocs\trackstar\protected\tests../../framework/yiit.php): failed to open stream: No such file or directory in D:\xampp\htdocs\trackstar\protected\tests\bootstrap.php on line 7

Fatal error: require_once(): Failed opening required ‘D:\xampp\htdocs\trackstar\protected\tests../../framework/yiit.php’ (include_path=’.;D:\xampp\php\PEAR’) in D:\xampp\htdocs\trackstar\protected\tests\bootstrap.php on line 7

my bootstrap file:


<?php


// change the following paths if necessary

$yiit=dirname(__FILE__).'../../framework/yiit.php';

$config=dirname(__FILE__).'/../config/test.php';


require_once($yiit);

require_once(dirname(__FILE__).'/WebTestCase.php');


Yii::createWebApplication($config);



You must correct $yiit and $config variables to point to right pathes. Where are your yiit.php and test.php files located?

The "chain" autocomplete does not work for me.

$cs = Yii::app()->clientScript-><ctrl>+<space> no suggestions

Any idea?

My solution for this topic is this one:

Create a new class that extends CWebApplication like the one below.




<?php

/**

 * @property CClientScript $clientScript

 * @property FCShowVideoClass $videoManager

 * @property CImageComponent $image

 * @property FCCloudFilesManager $cloudTv

 * @property FCCloudFilesManager $cloudImage

 * @property FCCloudFilesManager $cloudAudio

 * @property Curl $CURL

 * @property MailerMailCreator $mailCreator

 */

class FCWebApplication extends CWebApplication {

	/**

 	*  @return FCWebUser

 	*/

	public function getUser();

	

}



Then add a global function like the one below:




/**

 * This is the shortcut to Yii::app()

 * @return FCWebApplication

 */

function app()

{

	return Yii::app();

}



Notice the @return

Now, instead of using Yii::app(), use just app()-> <Ctrl>+<Space>

You will have code completion.

Hi

I Have this error: "No tests executed.(0,0 s)" and "Perhaps an error occurred, verify in Output window".

In php_error.log:

Class ‘WebTestCase’ not found …

My configuration is MAMP , Netbeans 7.1.1 (tried 7.2 and 7.0.1 but it’s the same), phpunit 3.6.10 and php 5.2.17.

I set bootstrap and xml configuration following http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/.

Thanks

[Solved]

I had bad include file in config/main.php.

I discovered the advantages of using code templates and added some information to the wiki page about it. See if you like it. :)

Hi,

I have no other ideas so i’m asking you guys for help.

I have:

xampp 3.0.12

phpunit 3.6.11

php 5.4.4

netbeans 7.2

selenium installed from netbeans plugin

I followed all steps in: http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/.

I used different modifications but i always get:

"No tests executed."

"Perhaps an error occurred, verify in Output window."

There are no errors.

Under "Tools > Options > PHP > Unit Testing"

PHPUnit Script x:\xampp\php\phpunit.bat

Skeleton Generator Script: (none)

Under "File > Project properties > Sources"

Test Folder: x:\xampp\htdocs\yii\trackstar\protected\tests\unit

Under "File > Project properties > PHPUnit"

Bootstrap: x:\xampp\htdocs\yii\trackstar\protected\tests\bootstrap.php

Use XML Configuration: x:\xampp\htdocs\yii\trackstar\protected\tests\phpunit.xml

@xerdos,

One common thing that pops to mind - your naming conventions.

How are your files and test named? Are they "PostTest.php" for files and "testReadNewCommemnt(){…}, having these conventions is how phpunit distinguishes a test file.

Hope this helps, let me know.

I had following everything in this thread, but PHPUnit still doesn’t work in my netbeans… it always return error “More than two positional arguments provided.”

So for now i used my shell for testing, can anyone provide best possible configuration for nunit to work with yii in netbeans?

PS

netbeans.yii.codetemplates.v2.zip

Referenced

http://fbe.am/hly

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

Bogus:

File is not a zip file.

actually is a script

Kind of annoying seeing how it looks from the cheat sheet to be cool




<script type="text/javascript">


  var _gaq = _gaq || [];

  _gaq.push(['_setAccount', 'UA-1714314-2']);

  _gaq.push(['_trackPageview']);


  (function() {

    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

  })();


</script>