Set timezone to UTC when testing date-related rules

Set default timezone explicitly to UTC so that tests do not fail in
other time-zones.

Co-authored-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
Casey McLaughlin 2020-06-23 15:26:23 -04:00 committed by Henrique Moody
parent 0a3f4c6a4b
commit f3faf50340
No known key found for this signature in database
GPG key ID: 221E9281655813A6
3 changed files with 6 additions and 0 deletions

View file

@ -11,6 +11,8 @@ use Respect\Validation\Exceptions\DateException;
use Respect\Validation\Exceptions\NestedValidationException;
use Respect\Validation\Validator as v;
date_default_timezone_set('UTC');
try {
v::date()->check('2018-01-29T08:32:54+00:00');
} catch (DateException $exception) {

View file

@ -11,6 +11,8 @@ use Respect\Validation\Exceptions\DateTimeException;
use Respect\Validation\Exceptions\NestedValidationException;
use Respect\Validation\Validator as v;
date_default_timezone_set('UTC');
try {
v::dateTime()->check('FooBarBazz');
} catch (DateTimeException $exception) {

View file

@ -11,6 +11,8 @@ use Respect\Validation\Exceptions\NestedValidationException;
use Respect\Validation\Exceptions\TimeException;
use Respect\Validation\Validator as v;
date_default_timezone_set('UTC');
try {
v::time()->check('2018-01-30');
} catch (TimeException $exception) {