You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you name the file containing this class "TestSuite.php" and run $ phpunit TestSuite.php, you receive
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Class does not extend PHPUnit_Framework_TestCase.' in /dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php:186
Stack trace:
#0 /home/dotxp/Desktop/phpunit_bug/TestSuite.php(7): PHPUnit_Framework_TestSuite->__construct('TestSuite') #1 [internal function]: TestSuite::suite('TestSuite') #2 /home/dotxp/dev/PHP/phpunit/PHPUnit/Runner/BaseTestRunner.php(124): ReflectionMethod->invoke(NULL, 'TestSuite') #3 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(150): PHPUnit_Runner_BaseTestRunner->getTest('TestSuite', '/home/dotxp/Des...', false) #4 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #5 /usr/local/php/php-5.3.3/bin/phpunit(53): PHPUnit_TextUI_Command::main() #6 {main}
thrown in /home/dotxp/dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php on line 186
The issue was with the name passed to the TestSuite constructor. It expects the name of a TestCase to start off with or an empty string to start an empty test suite taking it's name as the second constructor.
I don't see that as a big issue as using test suites for organization is discouraged since at least PHPUnit 3.5 (afaik).
As this is an older one I'll just close it and should this be an issue for you you know where to find me :)
Note the following code, which has been written after the example in http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.testsuite:
If you name the file containing this class "TestSuite.php" and run $ phpunit TestSuite.php, you receive
PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Class does not extend PHPUnit_Framework_TestCase.' in /dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php:186
Stack trace:
#0 /home/dotxp/Desktop/phpunit_bug/TestSuite.php(7): PHPUnit_Framework_TestSuite->__construct('TestSuite')
#1 [internal function]: TestSuite::suite('TestSuite')
#2 /home/dotxp/dev/PHP/phpunit/PHPUnit/Runner/BaseTestRunner.php(124): ReflectionMethod->invoke(NULL, 'TestSuite')
#3 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(150): PHPUnit_Runner_BaseTestRunner->getTest('TestSuite', '/home/dotxp/Des...', false)
#4 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#5 /usr/local/php/php-5.3.3/bin/phpunit(53): PHPUnit_TextUI_Command::main()
#6 {main}
thrown in /home/dotxp/dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php on line 186
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Class does not extend PHPUnit_Framework_TestCase.' in /dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php:186
Stack trace:
#0 /home/dotxp/Desktop/phpunit_bug/TestSuite.php(7): PHPUnit_Framework_TestSuite->__construct('TestSuite')
#1 [internal function]: TestSuite::suite('TestSuite')
#2 /home/dotxp/dev/PHP/phpunit/PHPUnit/Runner/BaseTestRunner.php(124): ReflectionMethod->invoke(NULL, 'TestSuite')
#3 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(150): PHPUnit_Runner_BaseTestRunner->getTest('TestSuite', '/home/dotxp/Des...', false)
#4 /home/dotxp/dev/PHP/phpunit/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#5 /usr/local/php/php-5.3.3/bin/phpunit(53): PHPUnit_TextUI_Command::main()
#6 {main}
thrown in /home/dotxp/dev/PHP/phpunit/PHPUnit/Framework/TestSuite.php on line 186
If you rename the file to something else, the suite runs fine.
The text was updated successfully, but these errors were encountered: