Installing PHPUnit on Mac Sierra
Answered
I used Composer to install PHPUnit (6.4) in my project.In preferences, I selected User Composer Autoloader and used this link:
/Documents/Websites/histest/vendor/autoload.php
It shows that I am using PHPUnit version 6.4.
When I run the debugger, I get the following error message:
Failed loading /Applications/MAMP/Library/bin/phpunit-6.3.0.phar: dlopen(/Applications/MAMP/Library/bin/phpunit-6.3.0.phar, 9): image not found
I don't see that this file was in the package that Composer installed.
I don't see anything in the documentation that addresses this issue.
How do I fix this?
TIA.
Please sign in to leave a comment.
Hi there,
Please check your php.ini (and all .ini files that PHP loads -- can be seen in phpinfo() output, top table) as well as PHP Interpreters in PhpStorm.
The error message suggests that for some reason PHP tries to load that /Applications/MAMP/Library/bin/phpunit-6.3.0.phar as PHP extension (dlopen() function).. which is obviously wrong, even if such file does exist).
Thanks, Andriy.
I cannot find any indication that phpunit is referenced in phpinfo or php.ini for the PHP version that I'm using. The php.ini file does not appear to have been modified since I installed the latest version of MAMP.
Am I looking in the wrong place?
TIA.
No idea (have not seen such issue before).
But please try creating brand new project and place few files there (the minimal that you need to run simple test) -- will it be any better?
If it will -- close IDE, go to that not-working project root and backup and delete .idea folder (this projects settings). Then launch IDE and using "Open" point to that project root folder -- it will create brand new project using existing files. Configure it and try there.
On another thought:
>When I run the debugger, I get the following error message:
>Failed loading /Applications/MAMP/Library/bin/phpunit-6.3.0.phar: dlopen(/Applications/MAMP/Library/bin/phpunit-6.3.0.phar, 9): image not found
Please show a screenshot of how did you configure your PHP Interpreter for that project. I have a feeling that issue might be there (you may have entered wrong thing in the wrong field)
In attempting to take the screenshot, I found the source of the 6.3.0 phar. I selected the 6.4 version that I installed with Composer and now have a different error:
Failed loading /Users/susan/Documents/Websites/histest/vendor/phpunit/phpunit/phpunit: dlopen(/Users/susan/Documents/Websites/histest/vendor/phpunit/phpunit/phpunit, 9): no suitable image found. Did find:
/Users/susan/Documents/Websites/histest/vendor/phpunit/phpunit/phpunit: file too short
I do not see a phar file with this version so that may be part of the problem.
I think this is the screenshot you requested. Please let me know if this is not correct.
Here's a second shot in case it helps.
>I do not see a phar file with this version so that may be part of the problem.
>I think this is the screenshot you requested. Please let me know if this is not correct.
As suspected -- it's an user-made error/misconfiguration.
As per your screenshot -- for whatever reason you have entered the path to the phpunit into "Debugger extension" field .. which is meant for xdebug extension (e.g. to only load xdebug for Debug and not for Run action)
Please make that field empty.
It works now.
Thank you so much for your help!