2

I just installed phpUnit and PHPUnit Skeleton Generator using the following guides phpUnit and PHPUnit Skeleton Generator. And then I start to configure phpUnit in NetBeans;

I go to

Tools-> Options ->  PHP -> Frameworks and Tools -> PHP Unit

and I changed PHPUnit Script to /usr/local/bin/phpunit and changed Skeleton Generator Script to /usr/local/bin/phpunit-skelgen. enter image description here

I also add PHP5 interpreter directory, which is /opt/lampp/bin/php. And finally add the folder that include both phpunit and phpunit-skelgen to Global Include Path. enter image description here

I tried to run the example in Getting Started with PHPUnit, Put i got No test Executed in Test result window and unrecognized option --run on Output window.

enter image description here

I found the following thread and do the solution provided

Solved by adding below line to Calculatortest.php file.

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

but the problem still exists. When i try to use terminal the test run correctly.

How can i solve this problem without removing netbeans ?

I'm using

  • Ubunut 14.04 LTS
  • PHPUnit 4.8.6 by Sebastian Bergmann and contributors,
  • NetBeans IDE 8.0.2
  • XAMPP
Community
  • 1
  • 1

2 Answers2

2

It happened the same to me, with a similar Ubuntu setup. And it started to happen once PHPUnit 4.8.x was downloaded in my Composer setup.

The only solution I found was to downgrade to PHPUnit 4.7.

It seems NB uses an extra argument that starts with --run= in its PHPUnit test suite script (<nbdir>/php/phpunit/NetBeansSuite.php), where test files to be run are separated by semicolons.

It worked up until PHPUnit 4.7.7, but it seems version 4.8 scans its arguments before invoking said testsuite file, and so it fails.

marcegarba
  • 66
  • 3
1

I had the same issue with the ''unrecognized option --run'' error. I was finally able to run the test suite from the command line by adding -- before the --run option. Like this:

phpunit --colors /tmp/NetBeansSuite.php -- --run=/var/www/html/private/test/RunAllTest.php

Not sure if it possible to be run it from Netbeans IDE though.

Hope it helps someone.

justadev
  • 1,168
  • 1
  • 17
  • 32