PHPunit Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() - laravel

i don't know if it's related to Laravel 5.4. when i run phpunit command after installing laravel 5.4 without making any changes i get Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() but when i run php artisan dusk it runs normally
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%)
any ideas how to fix this?

Seems like your version installed globally does not meet minimal required version. Try to run
phpunit --version
I bet you will get some like 5.1. The php artisan dusk command uses different version which is located in vendor/bin/phpunit. So, you are also able to use this version instead. Just type:
vendor/bin/phpunit
instead of phpunit. You have to upgrade your global phpunit version if it works.

In my case the following command worked in windows environment, with \ in place of /:
vendor\bin\phpunit

Had the same problem at Laravel 5.4. This worked for me.
Step 1: update your composer
composer update
Step 2: run the phpunit
vendor/bin/phpunit
You can run a specific test by specifying the file
vendor/bin/phpunit tests/Feature/ExampleTest.php

I have same issue ans solved with this step :
Check diff version
$ phpunit --version
PHPUnit 6.5.5 by Sebastian Bergmann and contributors.
$ ./vendor/bin/phpunit --version
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.
Update global phpunit:
if versions not equal update phpunit with
composer global require phpunit/phpunit:^8
check again versions
$ phpunit --version
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.
$ ./vendor/bin/phpunit --version
PHPUnit 8.3.5 by Sebastian Bergmann and contributors.

For any who is experiencing this, vendor/bin/phpunit definitely works but you might want to add this line to your .bashrc or .bash_profile or whatever convenient for you to make it works.
PATH="./vendor/bin:$PATH"
*tested on Linux only

I had same error with homestead laravel 5.6
when I ran phpunit command from my user it is works fine but when I ran it by sudo I got that error. try to run this command from your user not sudo maybe its work for you too

One solution is to add vendor/bin to the start of your path. On Unix like OSes running bash you can add the following to the end of your .bashrc file:
export PATH=vendor/bin:$PATH
In Windows 10, you can access your Path environment variable by accessing System Properties, Advanced tab and clicking the Environment Variables... button.
Either way, inserting vendor/bin at the front of the path will cause your OS to look for phpunit in ./vendor/bin. If you're in the root of your laravel project, it'll find the executable included with Laravel. If not, it'll move on to using the global version.

Related

laravel old version is not supporting php 8.0.8

I have installed php 8.0.8 on my local computer. Laravel new projects work perfect. But when I try to run Old projects it shows me error. When I try to run command
composer install
It gives me the error below:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
When I run:
composer dump-autoload
It shows this error:
Generating optimized autoload files Class App\Http\Controllers\Vendor\OrderController
located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Controllers\temp\OrderController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Http\Resources\profile\AddressesResponse located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Resources\Profile\AddressesResponse.php does not comply with psr-4 autoloading standard. Skipping.
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> #php artisan package:discover --ansi
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Unfortunately, older versions of Laravel doesn't not support newer versions of PHP. Laravel 6 is the minimal version for PHP 8.0 support (and it is already pretty old from a web development perspective).
Of course, this is for a fresh installation, you might have code in your project that is also not PHP 8.0 compatible.
About this error:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
The problem will be easy to fix, just install the soap extension. You seem on Windows so it should already installed but disabled.
You will have to uncomment ;extension=soap.dll in your php.ini file (or maybe in the ext directory located in your php directory, it depends).
There will probably be other extensions required but disabled, to get a full list execute composer check.
This is what is preventing composer from installing your dependencies (which lead Uncaught Error: Class "Illuminate\Foundation\Application" not found in to when you are calling composer dump-autoload).
I searched out and found a solution regarding this issue. Only single command is the solution
Note: Don't update composer.
composer install --ignore-platform-reqs

laravel error when I ran it on terminal in macos

when I ran laravel in my terminal it's not working, I already added the path to my bash_profile I am using MacOS. Valet is working I dont know what happened if it is from the installation or not.
this is the returned error:
PHP Fatal error: Uncaught Error: Class 'Laravel\Installer\Console\NewCommand' not found in /Users/mycomputer/.composer/vendor/laravel/installer/laravel:11
Stack trace:
#0 {main}
thrown in /Users/mycomputer/.composer/vendor/laravel/installer/laravel on line 11
Fatal error: Uncaught Error: Class 'Laravel\Installer\Console\NewCommand' not found in /Users/mycomputer/.composer/vendor/laravel/installer/laravel:11
Stack trace:
#0 {main}
thrown in /Users/mycomputer/.composer/vendor/laravel/installer/laravel on line 11

Fresh CentOS 7, first Laravel Installation.Composer install breaks

I am fallowing this tutorial:
http://linoxide.com/linux-how-to/install-laravel-php-centos-7-ubuntu-15-04/
And on step 5) when running composer install in the project directory it starts to do staff, as expected, until this happened:
Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
PHP Fatal error: Undefined constant 'Illuminate\Session\TokenMismatchException' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 779
Script php artisan optimize handling the post-install-cmd event returned with error code 255
What is the problem?
Thanks, Aleks
start creating a project (after updating composer) instead of downloading the referenced file do the following
from your terminal type in cd /var/www/
then type composer create-project laravel/laravel laravel-develop
your composer should download the latest version of Laravel
try it this way feel free to ask any questions.
Good Luck

Laravel Forge deploy errors from Composer update

My application works fine locally and is running on Digital Ocean. But I am getting the following two alternate deploy errors on Laravel Forge.
If I run:
composer update --no-dev
php artisan optimize
then I get the following error on Forge:
[RuntimeException]
The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.
If I run:
composer update
php artisan optimize
then I get this on Forge:
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Call to undefined method
Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException
Error Output: PHP Fatal error: Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath() in /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php on line 28
PHP Stack trace:
PHP 1. {main}() /home/forge/default/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /home/forge/default/artisan:36
PHP 3. Symfony\Component\Console\Application->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94
PHP 4. Symfony\Component\Console\Application->doRun() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:195
PHP 6. Illuminate\Console\Command->run() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Application.php:874
PHP 7. Symfony\Component\Console\Command\Command->run() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:101
PHP 8. Illuminate\Console\Command->execute() /home/forge/default/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257
PHP 9. Illuminate\Container\Container->call() /home/forge/default/vendor/laravel/framework/src/Illuminate/Console/Command.php:115
PHP 10. call_user_func_array:{/home/forge/default/storage/framework/compiled.php:925}() /home/forge/default/storage/framework/compiled.php:925
PHP 11. Illuminate\Foundation\Console\ClearCompiledCommand->fire() /home/forge/default/storage/framework/compiled.php:925
What am I doing wrong?
probably the easiest thing to do here is this.
in your local development environment double check your composer.json file for any items in the "require" section which should be in the "require-dev" section and move them if need be
Delete your local composer.lock file
Run composer install composer update -vvv
Test your application locally
When satisfied that everything is working in line with your expectations commit your composer.lock file back to your version control system and redeploy the application on Forge
If you continue to get errors on deploy and there is nothing else of worth on the server I'd destroy your old server instance then create a new server on Forge. Have it run the build with the new composer.lock file and I'm sure it will get you past this issue. :-D
On another note which may help, generally on deployment I'll favour composer install over composer update on the basis I'll have tested functionality based on specific versions of dependencies which are recorded in the composer.lock file. Following that approach means application behaviour should be more predictable. You'll risk encoutering unpredictable behaviour where you or one of your dependencies relies on a library which is always the latest version (e.g. dev-master) since the code could be changing very frequently.

Composer CreateProcess Error Code 0 during Zend Framework 2 installation

I'm stuck at the first step of the Zend Framework 2 Getting Started guide.
My steps:
I downloaded end extracted the newest version of composer to
c:/xampp/composer/composer.phar
I ran php composer.phar
self-update just in case.
I ran php composer.phar create-project
--repository-url="http://packages.zendframework.com" zendframework/skeleton-application ../htdocs/zf2-tutorial like it is
stated in the guide.
This is where I get this error message:
Fatal error: Uncaught exception 'ErrorException' with message 'proc_open():
CreateProcess failed, error code - 0' in phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php on line 1013
I will add the full call Stack in the end of the question.
What I aready tried:
The Guide in the answer to this question leads to the same error:
Installing Zend Framework 2 on XAMPP in Windows
I freed my RAM to ~2,7 Gb avalable space
I tried different installation guides
I ran the CLI with admin rights
My setup:
Windows 8
PHP 5.4.4
Composer version d017e3f2096dda7194600a76bc7328808811c8da
Server version: Apache/2.4.2 (Win32)
My questions:
Any suggestions to how to solve this problem?
Can I install ZF2 without using composer?
Call Stack:
0.0150 232360 1. {main}() C:\xampp\htdocs\ZendSkeletonApplication\composer.phar:0
0.0155 231416 2. require('phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/bin/composer') C:\xampp\htdocs\ZendSkeletonApplication\composer.phar:15
0.1072 2023984 3. Composer\Console\Application->run() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/bin/composer:43
0.1199 2234448 4. Symfony\Component\Console\Application->run() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/src/Composer/Console/Application.php:83
0.2064 3173376 5. Composer\Console\Application->renderException() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:128
0.2368 3201408 6. Symfony\Component\Console\Application->renderException() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/src/Composer/Console/Application.php:163
0.2369 3202256 7. Symfony\Component\Console\Application->getTerminalWidth() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:731
0.2369 3202272 8. Symfony\Component\Console\Application->getTerminalDimensions() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:797
0.2374 3202472 9. Symfony\Component\Console\Application->getConsoleMode() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:827
0.2374 3203768 10. proc_open() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:1013
0.2402 3204624 11. Composer\Util\ErrorHandler::handle() phar://C:/xampp/htdocs/ZendSkeletonApplication/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:1013
Surprisingly, it was much easier than I thought:
git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
It installed the framework under ./vendor/ZF2/.

Resources