I am trying to use phpunit
with Laravel 4, but I have Mcrypt problem.
At vendor/laravel/framework/src/Illuminate/Foundation/start.php
line 29, Laravel checks to see if mcrypt
is enabled.
if ( ! extension_loaded('mcrypt'))
{
die('Laravel requires the Mcrypt PHP extension.'.PHP_EOL);
exit(1);
}
When I phpunit
at CLI, it says;
Laravel requires the Mcrypt PHP extension.
This is not possible because following commands show that everything is OK.
$ php -v
PHP 5.4.4 (cli)
$ php --ini
Loaded Configuration File: /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
$ php -i | grep "mcrypt support"
mcrypt support => enabled
But... When I add following code at vendor/laravel/framework/src/Illuminate/Foundation/start.php
to see which PHP version is used, CLI displays 5.3.15
die(phpversion().PHP_EOL);
I don't know how this could be possible.
After adding the above code; php artisan
displays 5.4.4 but phpunit
displays 5.3.15. This is nearly impossible because both use vendor/laravel/framework/src/Illuminate/Foundation/start.php
to check if Mcrypt is enabled.
I'm not sure but does Laravel change something when it's in testing
environment?
I had the same issue on my mac with two versions of php (that one coming out of the box and another one from macport). so when using the command line, the php version you call depend of your bin path order (echo $PATH).
If you look at the hashbangs :
phpunit starts by #!/usr/bin/php
$/usr/bin/env php -v
PHP 5.3.25 (cli) (built: Jun 5 2013 12:14:23)
$/usr/bin/php -v
PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 28 2012 18:19:13)
Hope it helps,