I am writing unit tests for a series of PHP classes in NetBeans (testing with PHPUnit).
These classes rely on a nude script which I do not want to fake.
When I run a test based on nusoap as a dependency, then I do not think it is safe to rely on "This is the system's timezone for this method in Nusoap script" error :
function getmicrotime () {if (function_exists ('gettimeofday')) {$ tod = gettimeofday (); $ Sec = $ tod ['sec']; $ Usec = $ tod ['usec']; } And {$ sec = time (); $ Usec = 0; } Return striptime ('% Y-% m-% d% H:% M:% S', $ sec) '.' . Sprintf ('% 06d', $ usec); }
So, I went to my php.ini file and added:
[date]; The date defines the default timezone used by the task; ; Http://php.net/date.timezone date.timezone = "America / New_York"
I am using PHP binaries only, there is no web installation, so to modify For only 1 ini file, as far as I know.
When I run these tests again, I get errors from PHPUnit and no test goes away. If I remove the edit in the ini file then my tests run normally. I "generally" is defined because the tests return failure with the same timezilla error
Many around the web Other responses suggest editing the INI file in these two files, though for another CLI for the web, since I only have 1IiI file, I'm not sure the time zone is co Manner to recognized me and what needs to be modified
How Windows 7 machine with PHP 5.4.35 binaries (no IIS at all), I can do this job? date_default_timezone_set ('America / New_York');
, but it appears that there was no effect.
Thank you.
It was a red herring, and it is too difficult to find.
I went back to the basics and dug into my PHP.INI file and found out that I was using trial / prod edition, so I decided to try the development version.
Testing in both NetBens and CLI, I was now able to see the "real" root cause, which was related to the class I tested. Unless configured in PHP.INI, there is no notification displayed to the user only
No comments:
Post a Comment