0
  1. I get phpunit and install it as this link using the simplest way for test purposes. I just download the phpunit.phar file, chmod & rename & move to /usr/local/bin Then, I run phpunit --version, its ok.

  2. I write a simple php test case.

    class SimpleTest extends PHPUnit_Framework_TestCase {
        public function testSomething(){
           $this -> assertTrue(true);
        }
    }
    
  3. In terminal , I go to my php class folder, and execute

    phpunit --colors SimpleTest
    
  4. Now I got the exceptions

    PHP ReflectionException:  Method suite does not exist 
    in phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php on line 113
    
    PHP Stack trace:
    PHP   1. {main}() /usr/local/bin/phpunit:0
    
    PHP   2. PHPUnit_TextUI_Command::main($exit = *uninitialized*)
             /usr/local/bin/phpunit:612
    
    PHP   3. PHPUnit_TextUI_Command->run($argv = array (
             0 =>  '/usr/local/bin/phpunit', 
             1 => '--colors', 
             2 => 'SimpleTest.php'), 
             $exit = TRUE) 
            phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:129
    
    
    PHP   4. PHPUnit_Runner_BaseTestRunner->getTest(
           $suiteClassName = 'SimpleTest',   
           $suiteClassFile = '/home/kevin/Workspace/php/laravel/app/tests/SimpleTest.php',   
           $suffixes = array (0 => 'Test.php', 1 => '.phpt')) 
           phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:150
    
    PHP   5. ReflectionClass->getMethod('suite')    
    phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:113
    
    PHPUnit 3.7.27 by Sebastian Bergmann.
    

Anything is welcome, thanks .

1
  • 1
    A little suggestion; run it without colors - just to be sure. And: extend on the class TestCase. Commented Sep 17, 2013 at 15:11

1 Answer 1

1

It looks like this error comes from an xdebug setting.

The solution appears to be adding this line to your php.ini file (or changing your the existing value to 0):

xdebug.show_exception_trace = 0

Take a look at PHPUnit ReflectionException Method suite does not exist and Why does PHPUnit hide my xdebug backtrace? for more info.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks J.T. yes, I turn off this config, no exception now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.