PHPUnit抛出“警告:日期():它不安全……”
当运行phpunit –coverage-html时,我得到了关于时区的众所周知的警告.
一切都按预期工作,但它变得非常烦人. 当然,我可以通过更改我的php.ini来解决这个问题,但如果可能的话,我宁愿避免使用它,以保持一些服务器不可知性.另外,我不希望在我的可测试代码触发时阻止出现此警告. 有没有办法只为内部PHPUnit操作定义默认时区?
我在bootstrap.php文件中设置了TimeZone.
<?php // PHP and Web server settings error_reporting(E_ALL | E_STRICT); date_default_timezone_set("America/Toronto"); // Set the default timezone $_SERVER['SERVER_NAME'] = 'http://myserver'; // Set Web Server name // Process the Include Path to allow the additional application to be set. $IncludePaths = explode( PATH_SEPARATOR,get_include_path() ); $NewIncludePaths = array_merge( $IncludePaths,array(dirname(__FILE__) )); set_include_path( implode( PATH_SEPARATOR,array_unique($NewIncludePaths))); // Update Include Path //define('PHPUNIT_RUNNING',1); // Indicate to the code that Automated Testing is running. ?> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |