I am using MAC OS X El Capitan (Version 10.11.1).
I installed PHPUint using the following command:
brew install homebrew/php/phpunit
When I type which phpunit
in the terminal it outputs:
/usr/local/bin/phpunit
but when I run phpunit /pathto/file.php
, it gave me this error:
Parse error: parse error, expecting
'&'' or
"variable (T_VARIABLE)"' in phar:///usr/local/Cellar/phpunit/5.0.0/libexec/phpunit-5.0.0.phar/phar/phpunit-mock-objects/Framework/MockObject/Builder/InvocationMocker.php on line 82
So what I did was I installed phpunit again using these commands:
curl https://phar.phpunit.de/phpunit.phar -o phpunit.phar
chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
then when I try to use phpunit --version
it says:
This version of PHPUnit requires PHP 5.6; using the latest version of PHP is highly recommended.
So then I did:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
When I run phpinfo()
it says my PHP version is 5.6.10
. But again I tried to type phpunit --version
, the same:
This version of PHPUnit requires PHP 5.6; using the latest version of PHP is highly recommended.
After some research I found that’s may be because I have 2 installations of PHPUnit so I tried to remove PHPUnit using:
brew uninstall phpunit
it was successful, then again I tried to phpunit --version
, but still the PHP version issue.
And also if I try to do a brew uninstall phpunit
again, it will show a message:
Error: No such keg: /usr/local/Cellar/phpunit
UPDATE
When I type
php --version
in terminal it outputs
PHP 5.5.29 (cli) (built: Sep 9 2015 00:26:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
So I guess php version still picks up as 5.5.29 . I restarted apaches also .