Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit ReflectionException Method suite does not exist

I'm using PHPUnit version 3.6.2, and always got

PHP ReflectionException: Method suite does not exist in /pathTo/pear/PHPUnit/Runner/BaseTestRunner.php on line 113

when running single test:

phpunit path/to/my/ClassToTest.php

PHPUnit installed using pear, and I'm using php 5.3.6

are there any php configurations i should fix? or this just something that PHPUnit should fix.

the class

<?php

class ClassToTest extends PHPUnit_Framework_TestCase{

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

}
like image 565
herlambang Avatar asked Nov 29 '11 03:11

herlambang


3 Answers

I stumbled upon the same message after enabling xdebug extension.

Try adding this in your php.ini (or comment the line with the 1 for this value) :

    ; 0 is actually the default value
    xdebug.show_exception_trace = 0
like image 143
davm85 Avatar answered Oct 24 '22 05:10

davm85


If you're using VS Code and getting this exception while trying to debug your unit tests, make sure the Everything box is not checked in Breakpoints pane. Unchecking that box got me rid of this issue:

enter image description here

like image 44
dotNET Avatar answered Oct 24 '22 05:10

dotNET


To understand why "show_exception_trace=1" causes this problem, see: Why does PHPUnit hide my xdebug backtrace?

like image 2
thorie Avatar answered Oct 24 '22 06:10

thorie