Ignore/unignore 测试 phpunit.xml

Ignore/unignore tests in phpunit.xml

我正在使用 Laravel 我只想 运行 一个测试文件,不想重命名或编辑所有测试代码,最方便的地方指定要忽略的内容运行 对我来说是 phpunit.xml 所以我这样做了:

    <?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>

如您所见,我注释掉了 ./tests/ 文件夹,但其中的所有文件仍然是 运行,这很荒谬,我什至不知道 phpunit 还能从哪里获取该文件夹的路径? ??我只想运行 /tests/RunJustThisTest.php 文件。我想在 phpunit.xml 文件中指定它,而不是控制台或代码中的混乱。

我在 Netbeans 中加载 phpunit.xml 文件。

    "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.

这是 2011 年的 Netbeans 错误。他们说 "This is the expected behavior, I would say, for most of the users."。

这是参数--run=C:\xampp\htdocs\yyy\tests

如果有人解决了这个问题,请分享。

Why Netbean ignore PHPUnit testsuite from the XML config?

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