我不知道它是否与Laravel 5.4有关.当我phpunit
在安装laravel 5.4之后运行命令而没有做任何改变我得到Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()
但是当我运行php artisan dusk
它正常运行
c:\xampp\htdocs\ublocker>phpunit PHP Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1046 Stack trace: #0 C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(167): PHPUnit_TextUI_TestRunner->handleConfiguration(Array) #1 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #2 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #3 C:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() #4 {main} thrown in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1046 Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1046 Stack trace: C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(167): PHPUnit_TextUI_TestRunner->handleConfiguration(Array) C:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) C:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true) C:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() {main} thrown in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1046 c:\xampp\htdocs\ublocker>phpunit PHP Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1046 Stack trace: #0 C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(167): PHPUnit_TextUI_TestRunner->handleConfiguration(Array) #1 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #2 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #3 C:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() #4 {main} thrown in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1046 Fatal error: Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:1046 Stack trace: #0 C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php(167): PHPUnit_TextUI_TestRunner->handleConfiguration(Array) #1 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(176): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #2 C:\xampp\php\pear\PHPUnit\TextUI\Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #3 C:\xampp\php\phpunit(46): PHPUnit_TextUI_Command::main() #4 {main} thrown in C:\xampp\htdocs\ublocker\vendor\phpunit\phpunit\src\TextUI\TestRunner.php on line 1046 c:\xampp\htdocs\ublocker>php artisan dusk PHPUnit 5.7.7 by Sebastian Bergmann and contributors. F. 2 / 2 (100%)
任何想法如何解决这一问题?
似乎您在全球安装的版本不符合最低要求版本.尝试运行phpunit --version,我打赌你会得到一些像5.1.php artisan dusk使用位于"vendor/bin/phpunit"中的不同版本.因此,您也可以使用此版本.只需输入:"vendor/bin/phpunit"而不是"phpunit".如果有效,你必须升级你的全球phpunit版本
在Laravel 5.4遇到同样的问题.这对我有用.
第1步:更新您的作曲家
composer update
第2步:运行phpunit
vendor/bin/phpunit
您可以通过指定文件来运行特定测试
vendor/bin/phpunit tests/Feature/ExampleTest.php
在我的情况下,以下命令在Windows环境中工作,用"\"代替"/"
供应商\ BIN\PHPUnit的