This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 188240

Summary: PHPUnit shell command invalid syntax
Product: php Reporter: Trii
Component: PHPUnitAssignee: Tomas Mysik <tmysik>
Status: RESOLVED INCOMPLETE    
Severity: normal CC: phejl, tmysik
Priority: P3    
Version: 6.x   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description Trii 2010-06-30 13:35:00 UTC
The 6.9 version from the main website cannot run any phpunit tests due to a space in the application's name an no quoting done of the command line arguments passed to phpunit.

Here is a line from running a single test.

/usr/bin/phpunit --log-junit /var/folders/wG/wGrdprT6HmmuglFInzcWZk+++TI/-Tmp-/nb-phpunit-log.xml --bootstrap /Users/Josh/NetBeansProjects/Breach/MainRepo/tests/testinit.php NetBeansSuite /Applications/NetBeans/NetBeans 6.9.app/Contents/Resources/NetBeans/php/phpunit/NetBeansSuite.php run=/Users/Josh/NetBeansProjects/Breach/MainRepo/tests/application/classes/service/json/IncidentsTest.php


The offending argument is below.
/Applications/NetBeans/NetBeans 6.9.app/Contents/Resources/NetBeans/php/phpunit/NetBeansSuite.php

It is because of the space in the app name, Netbeans 6.9.app. Previous versions were just called Netbeans.app

Quoting that argument makes the command work
Comment 1 Trii 2010-06-30 13:38:33 UTC
Here is the actual output of the command:

Josh:~$ /usr/bin/phpunit --log-junit /var/folders/wG/wGrdprT6HmmuglFInzcWZk+++TI/-Tmp-/nb-phpunit-log.xml --bootstrap /Users/Josh/NetBeansProjects/Breach/MainRepo/tests/testinit.php NetBeansSuite /Applications/NetBeans/NetBeans 6.9.app/Contents/Resources/NetBeans/php/phpunit/NetBeansSuite.php run=/Users/Josh/NetBeansProjects/Breach/MainRepo/tests/application/classes/service/json/IncidentsTest.php
PHPUnit 3.4.14 by Sebastian Bergmann.

Cannot open file ".//Applications/NetBeans/NetBeans".
Comment 2 Tomas Mysik 2010-06-30 13:55:56 UTC
Do I understand correctly that if a project has a space in its name, PHPUnit support does not work? If not, please, provide exact steps to reproduce.

Thanks.
Comment 3 Trii 2010-06-30 14:01:38 UTC
If any of the path arguments have a space in them it will fail. In my example, the problem is that the default installed app on OS X is:

/Applications/Netbeans/Netbeans 6.9.app

The space between Netbeans and 6.9.app is causing the shell to treat them as two arguments.

I guess NetBeans makes its own custom PHPUnit suite and stores it in:

@APP_PATH@/Contents/Resources/NetBeans/php/phpunit/NetBeansSuite.php

When NetBeans passes this argument to phpunit (and all arguments for that matter) it should be quoted so it is treated as a single argument instead of two
Comment 4 Trii 2010-06-30 14:08:02 UTC
Just now I renamed the app and moved it to:

/Application/Netbeans/6.9/Netbeans.app and phpunit via the Test menu option works as expected.
Comment 5 Tomas Mysik 2010-06-30 15:04:40 UTC
I will try to reproduce and fix.
Comment 6 Filip Zamboj 2010-09-15 12:37:49 UTC
batch reassigning
Comment 7 Tomas Mysik 2011-06-03 10:19:04 UTC
Batch reassigning.
Comment 8 Tomas Mysik 2011-06-10 08:15:05 UTC
Right, it seems that the arguments are not quoted automatically. Needs to be fixed.
Comment 9 Tomas Mysik 2011-06-10 11:29:33 UTC
(In reply to comment #8)
> Right, it seems that the arguments are not quoted automatically. Needs to be
> fixed.

Petr, can you confirm, please? Or am I wrong?
Comment 10 Tomas Mysik 2011-06-13 11:26:46 UTC
After discussion with Petr, reassigning.

Thanks.
Comment 11 Petr Hejl 2011-06-13 14:19:05 UTC
Fixed in web-main 5f5ad3b12ec3.
Please verify.
Comment 12 Petr Hejl 2011-06-13 14:38:09 UTC
Command itself should be escaped as well: 342f06db94e1
Comment 13 Petr Hejl 2011-06-13 14:51:31 UTC
Executable escaped on windows only 2658c5b6dcf4.
Comment 14 Tomas Mysik 2011-06-14 12:19:09 UTC
Minor fix is needed in PHP project as well.
Comment 15 Tomas Mysik 2011-06-14 12:34:35 UTC
NetBeans test suite fixed (possible quotes taken into account).

http://hg.netbeans.org/web-main/rev/4d8758fcf164
Comment 16 Quality Engineering 2011-06-14 14:05:21 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/5f5ad3b12ec3
User: phejl@netbeans.org
Log: #188240 PHPUnit shell command invalid syntax
Comment 17 Tomas Mysik 2011-06-14 14:32:07 UTC
Reopening since this seems to be a problem specific only for Mac platform (I cannot reproduce on Linux).

Can you please try to reproduce your problem and tell us what are the arguments passed to the _phpunit script itself_? Just open your phpunit script and use "print_r()" function to print command line arguments ($_SERVER['argv']).

Please, reopen this issue and paste the result here.

Thanks for your coopeartion.
Comment 18 Petr Hejl 2011-06-14 14:43:51 UTC
The behavior of EPB reverted to original one 0a0953f22763.
Comment 19 Quality Engineering 2011-06-15 14:07:56 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/4d8758fcf164
User: Tomas Mysik <tmysik@netbeans.org>
Log: #188240 - PHPUnit shell command invalid syntax

Quotes taken into account.