Reputation: 4671
I'm using symfony3 and I want to use phpunit
I'm using MAMP and I created an alias to use its php
my php version is 5.6.10
which php
php: aliased to /Applications/MAMP/bin/php/php5.6.10/bin/php
with php --ini
I have this result
Configuration File (php.ini) Path: /Applications/MAMP/bin/php/php5.6.10/conf
Loaded Configuration File: /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
in /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
I set
date.timezone = "Europe/Rome"
I modified also php.ini from mamp with the same value
when I use phpunit
1) Tests\AppBundle\Controller\DefaultControllerTest::testIndex date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
In my phpinfo() I have
Directive Local Value Master Value
date.timezone Europe/Rome Europe/Rome
Upvotes: 1
Views: 3145
Reputation: 359
Your phpinfo()
says "Europe/Rome" is set, so I guess you already restarted the webserver?
I always set it with the date_default_timezone_set("Europe/Rome");
function in the top of a PHP file which always get's loaded.
Upvotes: 1
Reputation: 3331
In AppKernel you can set default_timezone like this
public function boot() {
date_default_timezone_set('Europe/Rome');
return parent::boot();
}
Upvotes: 1