(This is the first time when I'm testing with phpunit command line tool so I may be wrong)
On fresh D8 install (Standard profile) I'm running:
$ cd core
$ ./vendor/bin/phpunit
Here's the output:
Warning: 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 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php on line 291
PHPUnit 3.7.21 by Sebastian Bergmann.
Configuration read from /var/www/html/core/phpunit.xml.dist
......FFFF.....EEEEEEEEE....E.................................. 63 / 557 ( 11%)
............................................................... 126 / 557 ( 22%)
............................................................... 189 / 557 ( 33%)
............................................................... 252 / 557 ( 45%)
............................................................... 315 / 557 ( 56%)
............................................................... 378 / 557 ( 67%)
............................................................... 441 / 557 ( 79%)
............................................................... 504 / 557 ( 90%)
.....................................................
Time: 2 seconds, Memory: 45.50Mb
There were 10 errors:
1) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateFormat with data set #0 ('2009', NULL, 'Y', 'Y', '2009')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:129
2) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateFormat with data set #1 ('2009-10', NULL, 'Y-m', 'Y-m', '2009-10')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:129
3) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateFormat with data set #2 ('T10:30:00', NULL, '\\TH:i:s', 'H:i:s', '10:30:00')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:129
4) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateFormat with data set #3 ('10:30:00', NULL, 'H:i:s', 'H:i:s', '10:30:00')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:129
5) Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDates with data set #0 ('23 abc 2012', NULL, 'd M Y', '23 abc 2012 contains an invalid month name and did not produce errors.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:149
6) Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDates with data set #1 ('0000-00-00T45:30:00', NULL, 'Y-m-d\\TH:i:s', '0000-00-00T45:30:00 contains an invalid hour and did not produce errors.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:149
7) Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDates with data set #2 ('0000-00-99T05:30:00', NULL, 'Y-m-d\\TH:i:s', '0000-00-99T05:30:00 contains an invalid day and did not produce errors.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:149
8) Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDates with data set #3 ('0000-75-00T15:30:00', NULL, 'Y-m-d\\TH:i:s', '0000-75-00T15:30:00 contains an invalid month and did not produce errors.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:149
9) Drupal\Tests\Component\Datetime\DateTimePlusTest::testInvalidDates with data set #4 ('11-08-01T15:30:00', NULL, 'Y-m-d\\TH:i:s', '11-08-01T15:30:00 contains an invalid year and did not produce errors.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:149
10) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDateTimezone with data set #0 ('2007-01-31 21:00:00', NULL, 'Europe/Helsinki', 'DateTimePlus uses the system timezone when there is no site timezone.')
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 'Europe/Helsinki' for 'EEST/3.0/DST' instead
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:264
/var/www/html/core/lib/Drupal/Component/Datetime/DateTimePlus.php:160
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:169
--
There were 4 failures:
1) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDates with data set #6 (array(2010, 2, 28), 'America/Chicago', '2010-02-28T00:00:00-06:00')
Test new DateTimePlus(array (
'year' => 2010,
'month' => 2,
'day' => 28,
), America/Chicago): should be 2010-02-28T00:00:00-06:00, found .
Failed asserting that null matches expected '2010-02-28T00:00:00-06:00'.
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:50
2) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDates with data set #7 (array(2010, 2, 28, 10), 'America/Chicago', '2010-02-28T10:00:00-06:00')
Test new DateTimePlus(array (
'year' => 2010,
'month' => 2,
'day' => 28,
'hour' => 10,
), America/Chicago): should be 2010-02-28T10:00:00-06:00, found .
Failed asserting that null matches expected '2010-02-28T10:00:00-06:00'.
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:50
3) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDates with data set #8 (array(2010, 2, 28), 'Europe/Berlin', '2010-02-28T00:00:00+01:00')
Test new DateTimePlus(array (
'year' => 2010,
'month' => 2,
'day' => 28,
), Europe/Berlin): should be 2010-02-28T00:00:00+01:00, found .
Failed asserting that null matches expected '2010-02-28T00:00:00+01:00'.
/var/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:50
4) Drupal\Tests\Component\Datetime\DateTimePlusTest::testDates with data set #9 (array(2010, 2, 28, 10), 'Europe/Berlin', '2010-02-28T10:00:00+01:00')
Test new DateTimePlus(array (
'year' => 2010,
'month' => 2,
'day' => 28,
'hour' => 10,
), Europe/Berlin): should be 2010-02-28T10:00:00+01:00, found .
Failed asserting that null matches expected '2010-02-28T10:00:00+01:00'.
/var/www/htmlvar/www/html/core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php:50
FAILURES!
Tests: 557, Assertions: 1125, Failures: 4, Errors: 10.
Comments
Comment #1
berdirWorks fine for me, but there are open issues about the intl extension, maybe it's related to that?
#2000384: php-intl module causes problems with Date and Time fields when editing Basic Page
Comment #2
alexpottMaybe this offers some clues... http://forum.symfony-project.org/viewtopic.php?f=23&t=35488
Comment #3
alexpottbut also its not much of a unit test if the php environment is having this effect... perhaps setUp() should call date_default_timezone_set to ensure we're all testing the same thing?
Comment #4
ParisLiakos commentedor maybe in bootstrap.php where we do setlocale() ? i would be fine with either, since this wont be the only test doing date related stuff
Comment #5
claudiu.cristeaI see no intl module
Comment #6
claudiu.cristea@alexpott, those clues were pointing to my error.
Sorry everybody, false alarm :)
In fact on my Mac I'm using MAMP. For some reason, php it's also installed. From cli, running
$ phpis using the system PHP, not MAMP PHP and that one have no php.ini. This is poping up the error. I setup the environment to use the correct PHP CLI and now phpunit runs without any error.Comment #7
ParisLiakos commentedi reopen this, because i get it everytime i am on a different dev enviroment, mostly because Debian's php.ini comes with an empty
date.timezonein its php.iniso, while manually setting it, might be a good thing, this is annoying and we shouldnt force anyone to face all those warnings.
it also brings consistency to tests, like setlocale
Comment #8
berdirdoesn't.
*in* php.ini?
Sorry :)
Should only set it if there's no default timezone? Or should we explicitly define that tests should run in UTC, always?
Comment #9
ParisLiakos commentedi dont see anything bad, with setting every test on UTC..in contrast it makes all test consistent between enviroments.
i tried only setting it up only for the DateTimePlusTest::setUp but it spits a warning on the very start..that way there are no warnings:)
Comment #10
ParisLiakos commentedYou can observe those warnings here https://qa.drupal.org/pifr/test/600303#tabset-tab-4
seems this is not a problem for PHP5.3
Fixed #8
Comment #11
berdirNot sure if the test bot is just configured differently or if this only happens for PHP 5.4, but I think it makes sense to configure this and avoid different environments for unit tests anyway.
Comment #12
alexpottI agree
Committed bc58322 and pushed to 8.x. Thanks!
Comment #13.0
(not verified) commentedcode fix