santigarcor / vscode-phpunit-extended

MIT License
4 stars 2 forks source link

Executing PHPUnit with wrong version of PHP #6

Open mfour-merickson opened 6 years ago

mfour-merickson commented 6 years ago

If I execute PHPUnit test using plugin from within VSCode, it produces

image

However, if I execute the exact command that is constructed from terminal, it works

image

i have defined the phpunit binary as

image

So it seems that the extension is not reading the $PATH variable correctly

image

/usr/local/bin:/usr/local/mysql/bin:/Users/merickson/scripts:/usr/local/php5/bin:/usr/local/bin:/usr/local/mysql/bin:/Users/merickson/scripts:/usr/local/php5/bin:/Users/merickson/.nvm/versions/node/v8.11.2/bin:/Users/merickson/perl5/bin:/usr/local/bin:/usr/local/mysql/bin:/Users/merickson/scripts:/usr/local/php5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/merickson/.composer/vendor/bin:/usr/local/bin:/usr/local/mysql/bin:/Users/merickson/scripts:/usr/local/php5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
mfour-merickson commented 6 years ago

I have also tried defining the desired PHP to use in the user setting

image

image

santigarcor commented 6 years ago

It's weird, because as you see in your first screenshot it's executing the phpunit from the vendor/bin/phpunit file. Do you have multiple php installations?

mfour-merickson commented 6 years ago

@santigarcor In short, yes there are two versions of PHP installed (see screenshot below). The default PHP version is installed at (note, I am on macOS Sierra 10.12.6)

usr/bin/php

When applying the PHP 7.1 upgrade, it moves the path to (there are numerous articles how this is one, I have found this one you can reference -- https://medium.com/zenchef-tech-and-product/how-to-upgrade-your-version-of-php-to-7-0-on-macos-sierra-e1bfdea55a63)

usr/local/php5/bin

And, in order to get to the correct version, one must export the new path

export PATH=/usr/local/php5/bin:$PATH

This is the reason I added the above path to the PHPUnit binary setting

image

santigarcor commented 6 years ago

I'll try to replicate it in my PC and i'll let you know.