I am using symfony and phpunit for my tests.
I had a project in foodmeup.dev directory which I copied into foodmeupnew.dev
Now, when making a call to phpunit from phpStorm command line, I've got something strange with the autoload file being looked for in the previous folder.
See the following, at line 8 it's changing dir from foodmeupnew.dev to foodmeup.dev, how can I correct this ?
> D:\Divers\Programmation\Web\foodmeupnew.dev\bin\phpunit.bat -c app
Fatal error: Cannot redeclare getLadybug() (previously declared in D:\Divers\Programmation\Web\foodmeupnew.dev\vendoraulfraile\ladybug-themes\Ladybug\Plugin\Extra\Resources\php\helpers.php:12) in D:\Divers\Programmation\Web\foodmeup.dev\vendoraulfraile\ladybug-themes\Ladybug\Plugin\Extra\Resources\php\helpers.php on line 21
Call Stack:
0.0002 234304 1. {main}() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\phpunit:0
0.0088 1457264 2. PHPUnit_TextUI_Command::main() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\phpunit:36
0.0088 1463816 3. PHPUnit_TextUI_Command->run() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:99
0.0088 1466536 4. PHPUnit_TextUI_Command->handleArguments() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:109
0.0132 2056112 5. PHPUnit_TextUI_Command->handleBootstrap() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:575
0.0134 2065160 6. PHPUnit_Util_Fileloader::checkAndLoad() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:750
0.0136 2065352 7. PHPUnit_Util_Fileloader::load() D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\Util\Fileloader.php:36
0.0183 3407040 8. include_once('D:\Divers\Programmation\Web\foodmeup.dev\app\bootstrap.php.cache') D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\Util\Fileloader.php:52
0.0185 3409304 9. require_once('D:\Divers\Programmation\Web\foodmeup.dev\app\autoload.php') D:\Divers\Programmation\Web\foodmeup.dev\app\bootstrap.php.cache:5
0.0187 3411320 10. require('D:\Divers\Programmation\Web\foodmeup.dev\vendor\autoload.php') D:\Divers\Programmation\Web\foodmeup.dev\app\autoload.php:9
0.0191 3424808 11. ComposerAutoloaderInit751ca4f7e73ded3907cdc8698c543ac6::getLoader() D:\Divers\Programmation\Web\foodmeup.dev\vendor\autoload.php:7
0.0214 3630760 12. composerRequire751ca4f7e73ded3907cdc8698c543ac6() D:\Divers\Programmation\Web\foodmeup.dev\vendor\composer\autoload_real.php:45
EDIT:
I've taken the following measure to make sure foodmeup.dev was not hardcoded : - find and replace in content of every file including hidden and system files the string 'foodmeup.dev' by 'foodmeupnew.dev' - delete entire directory, create new one, pull git branch, run composer install, reset bootstrap.cache
same error happens again. I'm sure there might be some misconfiguration but I can find out where it's coming from. any clue ?
EDIT2
OK, I figured out that line 5 is loading phpunit configuration that contains the hardcoded 'foodmeup.dev' value. Where does this configuration come from... that is to find out
> $phpunit - D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:566
============================================================================================================
array(
[colors] => string(4) "auto"
[backupGlobals] => bool(false)
[bootstrap] => string(64) "D:\Divers\Programmation\Web\foodmeup.dev\app\bootstrap.php.cache"
)
EDIT 3
Digging into it, I figured out that in file D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:566
the realpath function applied to a relative path would render a different path.
var_dump($this->arguments['configuration'] . '/phpunit.xml');
string(15) "app/phpunit.xml"
var_dump(realpath($this->arguments['configuration'] . '/phpunit.xml'));
realpath($this->arguments['configuration'] . '/phpunit.xml') - D:\Divers\Programmation\Web\foodmeupnew.dev\vendor\phpunit\phpunit\src\TextUI\Command.php:529 ================================================================================================================================================================ string(56) "D:\Divers\Programmation\Web\foodmeup.dev\app\phpunit.xml"
How can that be that the realpath function renders a path with foodmeup.dev when the call is made from a file located in the foodmeupnew.dev directory ?
EDIT 4:
I figured out this is a phpStorm issue. there must be a global variable which sets the dir for php function. If I run the command from an external command line, the error does not arise