PHPUnit ReflectionException方法套件不存在

her*_*ang 7 php testing phpunit

我正在使用PHPUnit版本3.6.2,并且总是得到

PHP ReflectionException:第113行的/pathTo/pear/PHPUnit/Runner/BaseTestRunner.php中不存在方法套件

运行单一测试时:

phpunit path/to/my/ClassToTest.php
Run Code Online (Sandbox Code Playgroud)

使用pear安装PHPUnit,我使用的是php 5.3.6

我应该修复任何PHP配置吗?或者这只是PHPUnit应该修复的东西.

班级

<?php

class ClassToTest extends PHPUnit_Framework_TestCase{

    public function testSomething(){
        $this->assertTrue(true);
    }

}
Run Code Online (Sandbox Code Playgroud)

dav*_*m85 5

启用xdebug扩展后,我偶然发现了相同的消息。

尝试将其添加到您的php.ini中(或将此值注释为1):

    ; 0 is actually the default value
    xdebug.show_exception_trace = 0
Run Code Online (Sandbox Code Playgroud)


dot*_*NET 5

如果您正在使用 VS Code 并在尝试调试单元测试时遇到此异常,请确保未在Breakpoints窗格中选中Everything框。取消选中该框让我摆脱了这个问题:

在此处输入图片说明