Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 0.7.8. http-mock issues warnings because timezone and breaks phpunit tests #36

Open
JoeZ99 opened this issue Dec 1, 2016 · 2 comments

Comments

@JoeZ99
Copy link

JoeZ99 commented Dec 1, 2016

when trying to run tests with http-mock, there is this warning

PHPUnit 4.8.29 by Sebastian Bergmann and contributors.

.F.................................

Time: 203 ms, Memory: 10.00MB

There was 1 failure:

1) Doofinder\Api\Test\Management\ClientTest::testDummy
HTTP mock server standard error output should be empty
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
+[Thu Dec  1 10:37:39 2016] PHP Warning:  DateTime::createFromFormat(): 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 /home/jzarate/havet/php-doofinder/vendor/symfony/http-foundation/Response.php on line 333
+[Thu Dec  1 10:37:39 2016] PHP Warning:  DateTime::createFromFormat(): 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 /home/jzarate/havet/php-doofinder/vendor/symfony/http-foundation/Response.php on line 333

/home/jzarate/havet/php-doofinder/vendor/internations/http-mock/src/InterNations/Component/HttpMock/PHPUnit/HttpMockTrait.php:56
/home/jzarate/havet/php-doofinder/src/Test/Management/ClientTest.php:42

it's related to not having timezone defined.

Since http-mock starts its own process, nothing I do on phpunit tests (like disabling warnings, setting timezone, etc..) will fix this (http-mock runs in its own process)

I haven't found a way to pass php init options or the like to http-mock's process, phpunit is unusable

@pusherman
Copy link

set date.timezone in your php.ini

@lstrojny
Copy link
Contributor

That’s indeed unfortunate. The only idea I would have is to either throw an exception if date.timezone is not defined or set it to UTC. Comments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants