I try to write tests in laravel, but I can't even run example test, bcs I get error:
λ phpunit
PHP Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1042
Stack trace:
#0 E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(163): PHPUnit_TextUI_TestRunner->handleConfiguration(Array)
#1 E:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#2 E:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 E:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()
#4 {main}
thrown in E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1042
Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1042
Stack trace:
#0 E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(163): PHPUnit_TextUI_TestRunner->handleConfiguration(Array)
#1 E:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array)
#2 E:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true)
#3 E:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main()
#4 {main}
thrown in E:\www\ikcms\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1042
Of course, it happens after downloading laravel.
Laravel version: 5.3 PHPUnit: 5.0
If you use phpunit across multiple projects it's often easier to not mess with a globally installed phpunit but to run it from your project's vendor folder.
You can check your project with:
composer info phpunit/phpunit
(If you see an [InvalidArgumentException] Package phpunit/phpunit not found
then I would composer require phpunit/phpunit --dev
)
Since Laravel includes phpunit by default you more than likely can run
./vendor/bin/phpunit …
and also
composer exec 'phpunit …'
and you can be certain that you're running the version of phpunit specified in that project's composer.json.
I get the same error before upgrading Laravel's dependencies inculding phpunit.
The update gives the version 5.7.6 of PHPUnit instead of the version 5.6.*.
If you use the PHPUnit of your computer path it will gives you this error.
I think it will be fixed but for the moment you can execute PHPUnit with the binary included in your Composer's vendor by writing php vendor/bin/phpunit
on your project root. For me it works, you can try it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With