PHPUnit 5.2.12 Testcase未找到,PHPUnit 5.5.4找到



在写这篇文章之前,我搜索了这个主题,但没有关于我的具体问题的结果。

我最近开始使用PHPunit。我的IDE (PHPED从Nusphere)只支持Phpunit到5.2.12版本。有些东西不能正常工作,因为从命令行 PHPunit报告一个错误:

致命错误:Class 'PHPUNITFrameworkTestCase'在第7行C:UsersmyusermyprojecttestunitConfigTestrongtackoverflow.php中找不到

版本5.5.4的相同测试可以正常工作。为了调试的目的,我使用了一个最小的代码(没有自动加载,没有依赖于其他文件,等等),我尝试了自动加载,当然,版本5.5.4工作得很好。代码如下:

use PHPUNITFrameworkTestCase;

class StackTest extends testcase
{ 
    public function testMod0001T00010_Createconfigfiles() 
    {
       //Here my tests
    }
} 
**For PHPunit 5.5.4 this is the output
PHPUnit 5.5.4 by Sebastian Bergmann and contributors.
.                                                                   1 / 1 (100%)
Time: 491 ms, Memory: 15.25MB
OK (1 test, 0 assertions)**

这是预期的。

所以,我猜测试的类定义对于每个版本的PHPUnit是不同的。最后,我可以使用命令行,但通过IDE使用它更舒服。

谢谢。

应该可以。

use PHPUnitFrameworkTestCase;

class StackTest extends PHPUNIT_Framework_TestCase
{ 
    public function testMod0001T00010_Createconfigfiles() 
    {
       //Here my tests
    }
} 

最新更新