Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHPUnit(4.7.7)测试在cmd中工作,但在NetBeans(8.0.2)中不工作_Php_Netbeans_Phpunit - Fatal编程技术网

PHPUnit(4.7.7)测试在cmd中工作,但在NetBeans(8.0.2)中不工作

PHPUnit(4.7.7)测试在cmd中工作,但在NetBeans(8.0.2)中不工作,php,netbeans,phpunit,Php,Netbeans,Phpunit,首先,奇怪的是,Netbeans中的一些测试正在运行,但只有一些处于“更深层次”的测试不起作用 结构: Test ---Folder1 ---Folder2 ---Folder3 ---Folder4 ---Folder5 ---Folder6 ---testsThatWorkTest.php ---Folde

首先,奇怪的是,Netbeans中的一些测试正在运行,但只有一些处于“更深层次”的测试不起作用

结构:

Test
  ---Folder1
     ---Folder2
        ---Folder3
           ---Folder4
              ---Folder5
                 ---Folder6
                    ---testsThatWorkTest.php
                 ---Folder6-2
                    ---Folder7
                       ---testThatDontWorkTest.php
                    ---Folder7-2
                       ---testInHereWorkTest.php
  ---bootstrap.php
  ---phpunit.xml
我在输出窗口的Netbeans中收到的消息:

PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
Warning:    No whitelist configured for code coverage
Time: 562 ms, Memory: 12.00Mb

No tests executed!

Generating code coverage report in PHP format ... done
我在cmd中收到的消息:

PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
Warning:        No whitelist configured for code coverage
Time: 5.39 seconds, Memory: 20.75Mb

OK (1 test, 1 assertion)

Generating code coverage report in PHP format ... done
我将假定,由于测试工作正常,netbeans(工具->选项->php->phpunit和“右键单击”属性->测试)中的所有设置都是正确的

phpunit.xml文件:

<phpunit colors="true"
     bootstrap="bootstrap.php"
>
<testsuites>
    <testsuite name="databaseTests">
        <directory>./Folder0/</directory>
    </testsuite>
    <testsuite name="shopTests">
        <directory>./Folder1/Folder2/Folder3/Folder4/Folder5/</directory>
    </testsuite>
    <testsuite name="testFolder7">
        <directory>./Folder1/Folder2/Folder3/Folder4/Folder5/Folder6-2/Folder7/</directory>
    </testsuite>
</testsuites>
<logging>
    <log type="coverage-php" target="./Logs/coverage.serialized"/>
    <log type="json" target="./Logs/logfile.json"/>
</logging>
<php>
    <includePath>.</includePath>
     ...........more vars const etc ....
</php>
</phpunit>
只有Folder6和Folder7-2中的测试正在运行,而Folder7中的测试没有运行

我还为Folder7创建了一个测试套件

phpunit --testsuite testFolder7
我再次得到:

PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
Warning:        No whitelist configured for code coverage

Time: 577 ms, Memory: 12.00Mb

No tests executed!

Generating code coverage report in PHP format ... done

Edit3:当我重命名/重构文件夹Folder7->Folder8时运行测试。但是当我重新生成文件夹或文件时,我遇到了同样的问题。知道问题出在哪里吗?

在netbeans中以什么方式运行测试,以及对cmd使用什么命令?我编辑了我的帖子。为了确保Lib/phpunit.phar与Netbeans中的相同,Netbeans输出窗口会记录他用于运行测试的命令吗?类似于在cmdI中运行测试的东西我有一个终端,但这不是我的想法。我希望测试能够在Netbeans中运行,因为在测试结果窗口中,我可以更好地看到哪些测试通过了哪些测试没有通过。我建议找出Netbeans用来运行测试的命令。它可能应该在IDE的输出(日志)窗口中。它可能包含一个答案:您以什么方式在netbeans中运行测试,以及您对cmd使用什么命令?我编辑了我的帖子。为了确保Lib/phpunit.phar与Netbeans中的相同,Netbeans输出窗口会记录他用于运行测试的命令吗?类似于在cmdI中运行测试的东西我有一个终端,但这不是我的想法。我希望测试能够在Netbeans中运行,因为在测试结果窗口中,我可以更好地看到哪些测试通过了哪些测试没有通过。我建议找出Netbeans用来运行测试的命令。它可能应该在IDE的输出(日志)窗口中。它可能包含一个答案
phpunit --testsuite testFolder7
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.
Warning:        No whitelist configured for code coverage

Time: 577 ms, Memory: 12.00Mb

No tests executed!

Generating code coverage report in PHP format ... done