UI for PHPUnit support

I would like to continue writing about our PHPUnit support in NetBeans; today, let's have a look at our new addition - UI for test results.

First of all, please be sure that you have PHPUnit 3.3.0 or newer installed, otherwise you won't be able to use this new UI for test results (most features will be still available - Create PHPUnit test, Run/Debug file with results in Output window only).

Before we move on, let me thank Erno Mononen for his great job; Erno takes care about the common part of UI test runner for all the scripting languages in NetBeans (namely Ruby, Python, PHP). Visit his blog to get more information, you will see that some features are still missing in PHP, most of them because of lack of time, some of them are waiting for the upcoming release PHPUnit 3.4.0.

Now, let's move finally to the UI, let's test our PHP project:

Test a PHP project

When the results are ready, UI appears:

UI for PHPUnit's test results

As you can see, if some of our tests failed, one can easily investigate problems via messages attached directly to failing tests or using Output window. All this information is available as a tooltip as well (applies for test suite as well as for each test case).

Tooltip for failed tests

Similar UI is displayed when user tests just one file (via Run file action, shortcut SHIFT + F6).

Results for one test case

One can use buttons on the left side to rerun tests Rerun tests, to show only failed or all tests Show failed/all tests or to navigate to the previous or next failed test Go to next/previous failed test.

The whole output of PHPUnit script is available in Output window and could be very useful if, for example, any error occurs.

Text output of PHPUnit

As always, this feature is available in development version of NetBeans, please feel free to file issues in NetBeans IssueZilla (component php, subcomponent phpunit).

That's all for today, thanks for reading and we hope you enjoy this great new feature of PHP support in NetBeans!


Comments:

Hi Tomas,

This looks great!

How about bundling NetBeans with PHPUnit and XDebug so we developers don't have to go through the task of setting up these environments.

Posted by raymond on February 02, 2009 at 01:34 PM CET #

Nice, now all I need is for Cake (http://cakephp.org) and Maven for PHP (http://www.php-maven.org/) to be added and PHP will be cooking with propane.

Posted by Rob Weaver on February 02, 2009 at 01:45 PM CET #

To raymond: Bundling of PHP libraries is always problematic - one would like to use another version, the download size of the IDE grows and grows, PHP Include path has to be set correctly (so php.ini must be known and writable) etc.
With XDebug it's even more complicated - it's PHP extension so you have to solve issues with different PHP versions, operating systems etc.

Thanks for your positive feedback!
Tomas

Posted by Tomas Mysik on February 02, 2009 at 04:20 PM CET #

To Rob Weaver: To CakePHP - what kind of support exactly would you like to have in NetBeans? Could you please update issue http://www.netbeans.org/issues/show_bug.cgi?id=140918 if needed?
Could you please file a new issue for Maven for PHP?

Thanks,
Tomas

Posted by Tomas Mysik on February 02, 2009 at 04:24 PM CET #

Hello,

I'm watching netbeans php cvs mailing list to see what new cool features are you doing ;)

You were rewriting PHP parser recently? For some new netbeans parser framework?

Could you write something about it?

Posted by Michal on February 03, 2009 at 10:53 AM CET #

To Michal:
Nice to read, thanks a lot! :) Anyway, not sure which parser you mean exactly; the only parser I wrote last time is the one which parses XML log files produced by PHPUnit (to visualize test results, described in this blog post). But stay tuned, I hope I will finish soon another interesting parser; I will blog about it, of course (if I'm successful).
Thanks for positive feedback.

Posted by Tomas Mysik on February 03, 2009 at 01:19 PM CET #

Hello,

I'm talking about commit messages like "[hg] jet-parsing-api/php.project: GSF->CSL Migration, phase 0"

I thought it's related with this http://wiki.netbeans.org/ParsingAPI

Posted by Michal on February 03, 2009 at 11:54 PM CET #

To Michal:
Ah, I see now; yes, it's related to new infrastructure for editors but I don't know much about this area, editor guys do.

Posted by Tomas Mysik on February 04, 2009 at 02:37 AM CET #

Hi,
I have an issue with test creating:

Reproduce code:
<?php
class Foo extends Bar {
public function neco(){}
}
?>

Tools -> Create PHPUnit tests

Result: Warrning
Test were not generated for the following files:
foo.php
In output:
Fatal error: Class 'Bar' not found in /var/www/ .... /models/foo.php on line 2

(in application class 'Bar' is loaded by autoloading)

Posted by Michal Kocian on February 05, 2009 at 04:34 AM CET #

To Michal:
Please, file all the issues directly to IssueZilla and not here. Thanks a lot.
(However, looks like a bug in PHPUnit?)

Posted by Tomas Mysik on February 05, 2009 at 04:53 AM CET #

Tomas:
I have no idea, I am new in PHPUnit testing.
http://www.netbeans.org/issues/show_bug.cgi?id=157983

Posted by Michal Kocian on February 05, 2009 at 05:51 AM CET #

Hey Tomas,
Its a little late now... and im such tired, i cant really think in a good way to say:

Congratulations!
Wonderful job with Netbeans! Its primary IDE for PHP work!!

U got a devoted follower!

Btw,

Posted by Gustavo Schirmer on February 08, 2009 at 09:03 PM CET #

Hello,

This is offtopic, but maybe you will how it's going with development of subversion support in netbeans. Is it actively developed? Are there any blog, mailing list which describes fixes and new features?

Posted by Michal on February 10, 2009 at 09:19 AM CET #

To Gustavo Schirmer:
Thanks a lot! Nice to hear, really!

Posted by Tomas Mysik on February 11, 2009 at 10:05 AM CET #

To Michal:
Some information for subversion support in NetBeans IDE can be found here:
http://subversion.netbeans.org/

Please, report all issues using NB IssueZilla, component "subversion". Thanks.

Posted by Tomas Mysik on February 11, 2009 at 10:08 AM CET #

To raymond: Bundling of PHP libraries is always problematic - one would like to use another version, the download size of the IDE grows and grows, PHP Include path has to be set correctly (so php.ini must be known and writable) etc.
With XDebug it's even more complicated - it's PHP extension so you have to solve issues with different PHP versions, operating systems etc.

Thanks for your positive feedback!
Tomas

Posted by Warhammer Online Gold on March 11, 2009 at 11:05 PM CET #

Hello!

How about a dynamic synchronization of classes and tests? That is, if I do the test first time, then get it all the methods of the class. Similarly, I would like to be able to add a new method in the class and select "Add method to Class's TestCase". Is it possible in the future?

Posted by alexey_baranov on April 24, 2009 at 02:46 PM CEST #

Is it possible to do transitions between the model, view and controler like you did between a class and its test (in the menu "Navigate/Go to test- Navigate/Go to tested class" and shortcut "Alt + Shift + T"). It is constantly required to do as with tests.

To determine the classes of triples can be used files names and the names of the classes.

for example,
model: class ModelName in file ModelName.php
view: class ModelNameView in file ModelNameView.php
controller: class ModelNameControler in file ModelNameControler.php

Thanks!

Posted by alexey_baranov on April 24, 2009 at 02:58 PM CEST #

> Congratulations!
> Wonderful job with Netbeans! Its primary IDE for > PHP work!!

Absolutely agree. Great work!

Posted by guest on April 24, 2009 at 03:00 PM CEST #

> Congratulations!
> Wonderful job with Netbeans! Its primary IDE for > PHP work!!

Absolutely agree. Great work!

Posted by alexey_baranov on April 24, 2009 at 03:01 PM CEST #

How does Netbeans check which version of PHPUnit is installed?

I am running the latest version (installed via PEAR), but I always get:

PHPUnit (version ?.?.?) is too old, upgrade it if possible (the minimum version is 3.3.0).
Creating and running individual test is still possible.

What can I do to resolve this problem?

Posted by Tobias on May 11, 2009 at 11:40 AM CEST #

Ok, I found it out myself:

Go to file "[..]/pear/PEAR/PHPUnit/Runner/Version.php".
Replace

"return 'PHPUnit 3.4.0beta3 by Sebastian Bergmann.';"

with

"return 'PHPUnit 3.4.0 by Sebastian Bergmann.';"

I wonder why Netbeans does not make use of the function "public static function id()" which returns only the version.

Posted by Tobias on May 11, 2009 at 11:48 AM CEST #

Thanks a lot! Nice to hear, really!

Posted by system on July 06, 2009 at 10:21 AM CEST #

teşekkürler benim sitemde http://www.yatkiralamafiyatlari.com

Posted by yat kiralama on July 06, 2009 at 10:22 AM CEST #

After changing source file (eg arguments for asserts) and creating new test (Tools->Create PHPUnit test) it should ovewrite old test file.
Now we must delete test file.

Posted by serg on July 17, 2009 at 05:40 AM CEST #

istanbulda transfer de bir numarayız :)

Posted by istanbul transfer on July 17, 2009 at 10:23 AM CEST #

gercekden :)

Posted by istanbul transfer on July 17, 2009 at 10:24 AM CEST #

özel taşımacılık

Posted by istanbul transfer on July 17, 2009 at 10:24 AM CEST #

Pretty cool set of resources...thanks
http://winshow09.spaces.live.com

Posted by Point of Sale on July 19, 2009 at 10:41 PM CEST #

i have same problem as tobias, that is this error "PHPUnit (version ?.?.?) is too old, upgrade it if possible (the minimum version is 3.3.0).", the fix suggested by tobias doesn't work, the version given in Runner.php file is 3.3.17

hope someone can help me resolve this

Posted by mak on August 20, 2009 at 04:54 AM CEST #

Reproduce code:
<?php
class Foo extends Bar {
public function neco(){}
}
?>

Posted by göğüs estetiği on August 20, 2009 at 07:50 AM CEST #

Thank you by Admin

Posted by mirc on August 22, 2009 at 09:22 PM CEST #

php is needs hard working

Posted by ariston servisi on August 31, 2009 at 04:27 AM CEST #

i love php programming.

Posted by general electric sevisi on August 31, 2009 at 04:28 AM CEST #

asp is so good more than

Posted by siemens servisi on August 31, 2009 at 04:29 AM CEST #

thanx a lot

Posted by bandırma web tasarımı on August 31, 2009 at 01:04 PM CEST #

Hello. I also have a problem with "PHPUnit (version ?.?.?) is too old, upgrade it if possible (the minimum version is 3.3.0)."

Environment:
Product Version: NetBeans IDE 6.7.1 (Build 200907230233)
Java: 1.6.0_11; Java HotSpot(TM) 64-Bit Server VM 11.0-b16
System: Windows Vista version 6.0 running on amd64; Cp1251; ru_RU (nb)

Steps:
- netbeans already installed
- install php (from zip)
- install phpunit from pear (3.4.0)
- type C:\\php5\\php.exe as php interpreter
- type C:\\php5\\phpunit.bat as phpunit script
- add C:\\php5\\PEAR\\PHPUnit into global include path

phpunit --version returns:
PHPUnit 3.4.0 by Sebastian Bergmann.
(in sources described as
self::write(PHPUnit_Runner_Version::getVersionString() . "\\n\\n");)

What i doing wrong?

Posted by Dmitry on September 22, 2009 at 03:39 PM CEST #

Perfect.
My developer had issues so I thought I'd be nice enough and see if I can help.
I think this will do the trick

Posted by buy cheap sexy lingerie online on October 05, 2009 at 08:00 PM CEST #

Thank you by Admin

Posted by download movie hd on October 28, 2009 at 05:40 PM CET #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 29, 2009 at 08:06 PM CET #

thanks admin, great post..

Posted by web tasarım on November 03, 2009 at 04:23 AM CET #

Hi, i have a same problem with Dmitry and Tobias.
My netbean version is 6.8, phpunit ver 3.4.5

What the solution ??

Urgent !! Does netbean developer see the problem ?

Posted by hugo on December 20, 2009 at 03:05 PM CET #

I also struggled with the version ?.?.? problem. I solved it by putting phpunit.bat instead of phpunit as the file path

Posted by Michiel on January 06, 2010 at 12:13 PM CET #

Hi, i have a same problem with Dmitry and Tobias.
My netbean version is 6.8, phpunit ver 3.4.5

What the solution ??

Posted by ED Hardy Suit on February 07, 2010 at 12:24 AM CET #

Very, very nice tool :D but i found some bugs:
- when i use "create php unit tests" i got fatal error because autoload do not work (probably bootstrap should be runned before). I have configured my own bootstrap.php to run all tests but i can not use generator and need to write all tests manualy.

Posted by G.Marchwinski on February 12, 2010 at 03:39 PM CET #

Regarding the G.Marchwinski comment above - you can set your bootstrap.php to be run during the PHP Unit Test generation if you pass a '--bootstrap your/bootstrap/location/bootstrap.php' at Tools->Options->PHP->Unit Testing->PHPUnit Script.

I believe this is the only way to set custom paths to your external sources and all.

Posted by pepper_bg on February 26, 2010 at 01:58 PM CET #

Again regarding the G.Marchwinski and pepper_bg comment above, when using that method described by pepper_bg, make sure all the include paths set in the bootstrap are absolute paths.

Posted by zijin on March 14, 2010 at 07:50 PM CET #

when i use "create php unit tests" i got fatal error because autoload do not work (probably bootstrap should be runned before). I have configured my own bootstrap.php to run all tests but i can not use generator and need to write all tests manualy.

Posted by Görüntülü Chat on April 22, 2010 at 06:55 PM CEST #

when using that method described by pepper_bg, make sure all the include paths set in the bootstrap are absolute paths.

Posted by Pandora beads on May 03, 2010 at 01:58 AM CEST #

RE: the problem described by Dmitry and Tobias ... you need to add /usr/share/php to your php path. The include directives in the PHPUnit files start with PHPUnit/ so /usr/share/php/PHPUnit in your include path wont work. FYI - I installed via an Ubuntu 10.04 package ... it should have handled this correctly, but oh well...

For php5 create a file /etc/php5/conf.d/phpunit.ini and add to it ...

[PHPUnit]
include_path=${include_path} ":/usr/share/php"

Restart apache and try again.

Posted by MikeG0 on June 06, 2010 at 12:24 AM CEST #

Im having the same problems as Tobias.

a crazy idea which worked for me....

In php.ini...make open_basedir =

Yes, make "open_basedir equal nothing".

check http://php.net/open-basedir if you care what side effects this will have.

Posted by Gee0 on June 08, 2010 at 12:05 AM CEST #

possibility of sharing and social solidarity at a level just fine thank you

Posted by Buz on August 23, 2010 at 08:40 AM CEST #

Just a note, I had the "PHPUnit (version ?.?.?) is too old, upgrade it if possible (the minimum version is 3.3.0)." problem mentioned above. The culprit turned-out to be my antivirus (Comodo), which was stopping NetBeans from retrieving the desired data.

Posted by Colin on August 30, 2011 at 09:45 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blogs is written by NetBeans developers who contribute to the PHP support mainly.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today