21296 Posts in 5734 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1084 Views |
-
Unit Test Failures

12 February 2011 at 3:52am
Hey, I just fetched a copy of the stable build off SVN, installed it and ran all unit tests. For some reason I get two failures:
β Date Test::test Nice Date
Date->Nice() works with timestamp integers
Failed asserting that <string:31/03/2008> is equal to <string:01/04/2008>.
Date->Nice() works with timestamp integersβ Date Test::test Long Date
Date->Long() works with numeric timestamp
Failed asserting that <string:31 March 2008> is equal to <string:1 April 2008>.
Date->Long() works with numeric timestampAny idea what the problem is?
Another frustrating thing is that the unit tests rely on php5-curl and php5-tidy being installed, but this is not mentioned in the system requirements.
-
Re: Unit Test Failures

12 February 2011 at 7:53am Last edited: 12 February 2011 8:12am
I don't get it. The timezone is set to Europe/Berlin in my PHP installation and 1206968400 is March 31st, 2008 for this timezone. However, the unit test is setting the timezone to Pacific/Auckland and for that timezone, 1206968400 is April 1st, 2008:
Here's a small test:
<?php
$tz = ini_get('date.timezone');
ini_set('date.timezone', 'Pacific/Auckland');
echo date('r', 1206968400) . PHP_EOL;
ini_set('date.timezone', $tz);
?>Edit: If I run the DateTest alone, the test passes, but not when I run all of them. O_o
-
Re: Unit Test Failures

12 February 2011 at 2:48pm
Interesting. Are you running just the sapphire test suite or your application tests as well?
What is the timezone at the top of the testNiceData() test?
Another frustrating thing is that the unit tests rely on php5-curl and php5-tidy being installed, but this is not mentioned in the system requirements.
Good point, I think these 2 should be warnings (rather than errors) for the installer. Could you raise this as a bug on open.silverstripe.org.
-
Re: Unit Test Failures

12 February 2011 at 11:38pm Last edited: 12 February 2011 11:40pm
Interesting. Are you running just the sapphire test suite or your application tests as well?
Fresh unmodified copy either from SVN or as tar.gz, installed, then called /dev/tests/all. First it told me that I need PHPUnit which makes sense, but isn't documented AFAIK, then I had something like 11 fails because the curl and tidy extensions were missing and now I only get the two fails mentioned above when testing the date functions. If I call the DateTest (/dev/tests/DateTest) alone, I get 2 passes.
What is the timezone at the top of the testNiceData() test?
Something is borked...
var_dump(ini_get('date.timezone')); --> string 'Pacific/Auckland' (length=16)
var_dump(date('r')); --> string 'Sat, 12 Feb 2011 10:55:48 +0100' (length=31)When I execute DateTest alone, I get...
var_dump(ini_get('date.timezone')); --> string 'Pacific/Auckland' (length=16)
var_dump(date('r')); --> string 'Sat, 12 Feb 2011 23:17:47 +1300' (length=31) -
Re: Unit Test Failures

13 February 2011 at 3:38pm
Raise this as an issue on open.silverstripe.org as a bug. Include what branch / tag / revision you downloaded.
| 1084 Views | ||
|
Page:
1
|
Go to Top |


