1

I am using Laravel and I want to run just one test file, and don't want to rename or edit all over test code, the most convenient place to specify what to ignore and what to run for me is phpunit.xml so I did this:

    <?xml version="1.0" encoding="UTF-8"?>
    <phpunit backupGlobals="false"
             backupStaticAttributes="false"
             bootstrap="bootstrap/autoload.php"
             colors="true"
             convertErrorsToExceptions="true"
             convertNoticesToExceptions="true"
             convertWarningsToExceptions="true"
             processIsolation="false"
             stopOnFailure="false"
             syntaxCheck="false">
        <testsuites>
            <testsuite name="Application Test Suite">
                <!--<directory>./tests/</directory>-->
                <file>./tests/RunJustThisTest.php</file>
            </testsuite>
        </testsuites>
        <php>
            <env name="APP_ENV" value="testing"/>
            <env name="CACHE_DRIVER" value="array"/>
            <env name="SESSION_DRIVER" value="array"/>
        </php>
    </phpunit>

As you see I commented out ./tests/ folder but all files from it are still being run which is absurd, I don't know even where else is phpunit getting path to that folder??? I want to run just /tests/RunJustThisTest.php file. And I want to specify it in phpunit.xml file, not console or messing in code.

I load phpunit.xml file in Netbeans.

    "C:\xampp\php\php.exe" "C:\xampp\php\phpunit" "--colors" "--log-junit" "C:\Users\xxx\AppData\Local\Temp\nb-phpunit-log.xml" "--configuration" "C:\xampp\htdocs\yyy\phpunit.xml" "C:\Program Files\NetBeans 8.0.1\php\phpunit\NetBeansSuite.php" "--run=C:\xampp\htdocs\yyy\tests"
    PHPUnit 4.8.27 by Sebastian Bergmann and contributors.

enter image description here

S S
  • 987
  • 1
  • 9
  • 20
  • 1
    How are you invoking PHPUnit? Through an IDE or the console? Can you see that configuration file is being read in the command (if through an IDE)? – Katie Sep 21 '16 at 12:22
  • I edited post. Xml is loaded, if I make syntax error in xml it reports it. – S S Sep 21 '16 at 12:39
  • 1
    Weird. I don't see any errors in your xml, so I don't have any more ideas, I even loaded your example with my configuration and it worked fine. (running through PHPStorm though). Sorry I couldn't be of more help. You could try running it in the console to further understand the behavior. – Katie Sep 21 '16 at 12:44

1 Answers1

1

This is Netbeans bug from 2011., they say "This is the expected behavior, I would say, for most of the users.".

This is the argument --run=C:\xampp\htdocs\yyy\tests.

If someone made workaround around this please share.

Why Netbean ignore PHPUnit testsuite from the XML config?

https://netbeans.org/bugzilla/show_bug.cgi?id=199072

Community
  • 1
  • 1
S S
  • 987
  • 1
  • 9
  • 20
  • 1
    That is a real bummer, but I suspect their thinking is that most people want to run all tests in the folder they've marked to hold tests. I switched to PhpStorm a couple years ago so I don't recall if you actually tell NetBeans "*this* is my test sources folder" as you do in PhpStorm. – David Harkness Sep 22 '16 at 19:14