Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Unit Test Failures


Reply


5 Posts   1311 Views

Avatar
smares

Community Member, 25 Posts

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 timestamp

Any 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.

Avatar
smares

Community Member, 25 Posts

12 February 2011 at 7:53am

Edited: 12/02/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

Avatar
Willr

Forum Moderator, 5513 Posts

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.

Avatar
smares

Community Member, 25 Posts

12 February 2011 at 11:38pm

Edited: 12/02/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)

Avatar
Willr

Forum Moderator, 5513 Posts

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.