How do I fix my NetBeans + PHPUnit integration?

Active3 hr before
Viewed126 times

7 Answers


I ran into this question: How do I fix my NetBeans + PHPUnit integration?,But applying the fix mentioned there does not work. Netbeans keeps saying the version of PHPUnit is too old and that I need at least 3.3.0, while I am using 3.3.9.,Well, NetBeans obviously does not recognize the PHPUnit's version, the "too old" sentence is misleading in this case. I guess the problem is in the PHPUnit instalation and setup, not in the version.,If you find copyright violations, you can contact us at to request the removal of the content.

In my case PEAR was set up under F:/php5/PEAR. So i had to add this line

include_path = ".;F:\php5\PEAR

include_path = ".;F:\php5\PEAR

I Followed the steps listed in this testing with PHPUnit to integrate PHPUnit to netbeans. As described in Installing PHPUnit section of that doc, by clicking search button under Netbeans->preferences->unit testing my netbeans recognizes PHPUnit installation.,I am newbie to any kind of testing. I just installed pear and PHPUnit using this doc. I use netbeans 7.3.1. I also installed skeletongenerator running this command : pear install phpunit/PHPUnit_SkeletonGenerator. ,I followed all the steps to add sample Calculator project and generate test class. I did that. But when I run the tests by right clicking Calculator.php file and selecting Test I get following result.,Also, I had to change php.ini file so that errors are displayed in case there are. I set following variables in php.ini.

Solved by adding below line to Calculatortest.php file.

require_once dirname(__FILE__).

Also, I had to change php.ini file so that errors are displayed in case there are.
I set following variables in php.ini.

error_reporting = E_ALL | E_STRICT
display_errors = On
load more v

So when Netbeans says it offers support for PHPUnit 3.4.0 or higher, it’s okay to expect the integration to be out of date. Rather surprisingly, it’s actually worked right up to PHPUnit 8.1.,For more information (and a possible fix), follow the Netbeans Issue.,Fix: Single File Tests Break in Netbeans 11.0 / PHPUnit 8.2,UPDATED 2019-07-22: Netbeans 11.1, released today, incorporates a robust fix for this problem that should survive future changes in PHPUnit.

So here’s the kludge: in the file TextUI/Command.php in the handleArguments array, just change the line that reads

if (isset($this - > options[1][1])) {
load more v

NetBeans IDE also supports the Selenium portable test framework, in combination with PHPUnit. A Selenium plug-in is available from the Update Center. Installing this plugin adds a Selenium server to the IDE’s registered servers and adds Selenium test options to the PHP menus.,NetBeans IDE has a plugin that includes a Selenium server. With this plugin, you can run Selenium tests on PHP, Web Application, or Maven projects. To run Selenium tests on PHP, you need to install the Testing Selenium package to your PHP engine.,In the IDE, open Tools > Plugins and install the Selenium Module for PHP., In the IDE, open Tools > Plugins and install the Selenium Module for PHP.

< ? php
class Calculator {
   function add($a, $b) {
      return $a + $b;
} ?
load more v

To use PHPUnit integrated with Netbeans, you must specify a file that will be used to execute the PHPUnit commands, which can be the PHPUnit executable itself or a script. To indicate the file, it must be on the same machine where Netbeans is installed so that it can access it. , I use Netbeans 7.4 on Mac to program. And to not have to install PHP and PHPUnit, I would like to run PHPUnit installed on a virtual machine that has an entire integration environment already configured. This practice has been heavily used, and is displayed on sites like PHP The Right Way . , This would seem to work, but it is for Windows and needs specific path of a test folder. I have several projects in Netbeans, if I fix a test folder in this script, I could use PHPUnit for just one project. , Another problem I have when creating a script for Netbeans to run PHPUnit is that the local paths are different from the virtualized server. I found other solutions using SSH, but the SSH connection requires a password, which makes it difficult to use the SSH command.

And set up in the file .sh

[email protected]

NetBeans IDE (Integrated Developer Environment) for PHP provides tools for PHP programmers. The core of NetBeans PHP support is the PHP Editor, which includes code completion and other programming aids. NetBeans IDE for PHP can also be integrated with the Xdebug debugger, PHPUnit tester, and PHPDocumentor documentation generator.,The NetBeans IDE for PHP community consensus is that the XDebug installation wizard should be used to install XDebug.,Before you begin to work with PHP applications in the IDE you need to install and configure your PHP environment. The PHP environment includes:,For more details, see the following document:

The IDE provides a wizard that enables you to create a new empty PHP project or to create a PHP project from existing sources that are located on your local system or on a remote server. The IDE provides basic support for FTP and SFTP, however, it is preferable to use version control with remote projects and use a version control system to commit your changes to the remote server.

By default the IDE places all project files in your web server's public folder (such as /htdocs). The IDE reads the location of your web server from your PHP environment. However, you have other options for file locations. These options appear in the New Project wizard:

load more v

7.2 Keyboard shortcuts,NetBeans comes with integrated CVS support which might be the easiest way to check out Moodle. ,NetBeans IDE 6.x Keyboard Shortcuts Specification,Top 10 NetBeans IDE Keyboard Shortcuts I use the most

1. You may want to run NetBeans with the Sun JDK. NetBeans seems to work a bit better with the Sun JDK. You'll have to edit NetBeans config file. Open netbeans/etc/netbeans.conf. Then uncomment and edit:

netbeans_jdkhome = "your_JDK_path"
load more v

Other "undefined-undefined" queries related to "How do I fix my NetBeans + PHPUnit integration?"