Skip to content

Coverage: error is triggered when calling date() function in template.phtml (PHP 5.6) #195

@klimesf

Description

@klimesf

When I run vendor/bin/tester with --coverage parameter, the generated coverage.html contains this error:

Generated by Nette Tester at Error: date(): 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.

config.neon contains timezone settings and is loaded via bootstrap in each test:

php:
    date.timezone: Europe/Prague

however, I still get the error.

Issue appears to get fixed by calling date_default_timezone_set() in Tester\CodeCoverage\template.phtml

<?php date_default_timezone_set("Europe/Prague"); ?>

Should I create a pull request, or is there a better way to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions