[ 
https://issues.apache.org/jira/browse/NETBEANS-2573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16846861#comment-16846861
 ] 

Alan Langford commented on NETBEANS-2573:
-----------------------------------------

{quote}What I can say now is that I really don't get why PHPUnit does this. 
What problem/situation are they solving by these changes?
{quote}
The commit comment from their repo is "Fixed a fatal TypeError when an invalid 
file is given as the second argument". The change to PHPUnit is simply making 
command line parsing more robust. A perfectly reasonable thing to do IMO. There 
is no --run=... argument, and I'm pretty sure they're not going to be open to 
adding some kind of argument pass-through mechanism.That said, their parser 
does ignore additional arguments. I have a command line that gets through:
{code:java}
php.exe "{project_path}\vendor\phpunit\phpunit\phpunit" "--colors" 
"--log-junit" "{temp}\nb-phpunit-log.xml" "--configuration" 
"{project_path}\phpunit.xml" "--coverage-clover" 
"{temp}\nb-phpunit-coverage.xml" "NetBeansSuite" "C:\Program Files\netbeans 
11\php\phpunit\NetBeansSuite.php" "{project_path}\tests\SomeTest.php"
{code}
That adds "NetBeansSuite" as the explicit test name and removes the --run= 
prefix on the file to be testedThis just requires that NetBeansTest.php extract 
the last entry from $argv instead of looking for something prefixed by --run=
I still think generating a XML file by transforming the user's file is less 
brittle. It puts all the logic inside Netbeans and keeps us form having to 
track breaking changes in PHPUnit (like this, from the current 
NetBeansTest.php):
{code:java}
// keep BC with PHPUnit versions < 6
if (!class_exists('PHPUnit_Framework_TestSuite')) {
    class PHPUnit_Framework_TestSuite extends PHPUnit\Framework\TestSuite {}
}

{code}

> PHPUNIT update breaks running single test
> -----------------------------------------
>
>                 Key: NETBEANS-2573
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-2573
>             Project: NetBeans
>          Issue Type: Bug
>          Components: php - PHPUnit
>    Affects Versions: 11.0
>         Environment: Netbeans 11.0, PHP 7.3
>            Reporter: Alan Langford
>            Assignee: Tomáš Myšík
>            Priority: Major
>
> When running a single test file and PHPUnit installed via composer, Netbeans 
> generates a command line of this general form:
> php.exe "\{project}\vendor\phpunit\phpunit\phpunit" "--colors" "log-junit" 
> "\{temp}\nb-phpunit-log.xml" "configuration" "\{project}\phpunit.xml" 
> "coverage-clover" "\{temp}\nb-phpunit-coverage.xml" "C:\Program 
> Files\netbeans 11\php\phpunit\NetBeansSuite.php" "--" 
> "–run=\{project}\tests\SomeTest.php"
> The "–" argument used to fool PHPUnit. PHPUnit would strip the dashes and 
> pass a empty string for the name of the test file.
> NetBeansSuite.php would then extract the --run=argument and run the test.
> The latest master for PHPUnit (a79e18fe27) has changed the way command lines 
> are parsed; the "–" is discarded. PHPUnit then reports an error:
> Cannot open file "–run=\{project}\tests\SomeTest.php"
> I believe passing
> NetBeansSuite "C:\Program Files\netbeans 11\php\phpunit\NetBeansSuite.php"
> instead of
> "C:\Program Files\netbeans 11\php\phpunit\NetBeansSuite.php" "–"
> Will resolve the problem.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to