Page MenuHomePhabricator

CLDR breaks core timestamp tests
Closed, ResolvedPublic

Description

Without CLDR installed:

$ php phpunit.php includes/TimestampTest.php
PHPUnit 3.7.27 by Sebastian Bergmann.

Configuration read from /www/mediawiki/core/tests/phpunit/suite.xml

.............................................

Time: 290 ms, Memory: 18.50Mb

OK (45 tests, 65 assertions)

With CLDR installed:

$ php phpunit.php includes/TimestampTest.php
PHPUnit 3.7.27 by Sebastian Bergmann.

Configuration read from /www/mediawiki/core/tests/phpunit/suite.xml

........................FF..FFFFFFFF.........

Time: 298 ms, Memory: 19.25Mb

There were 10 failures:

  1. TimestampTest::testHumanTimestamp with data set #0 ('20111231170000', '20120101000000', 'Offset|0', 'mdy', 'Yesterday at 17:00', '"Yesterday" across years')

"Yesterday" across years
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Yesterday at 17:00'
+'7 hours ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #1 ('20120717190900', '20120717190929', 'Offset|0', 'mdy', 'just now', '"Just now"')

"Just now"
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'just now'
+'29 seconds ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #4 ('20120617190900', '20120717190900', 'Offset|0', 'mdy', 'June 17', 'Another month')

Another month
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'June 17'
+'1 month ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #5 ('19910130151500', '20120716193700', 'Offset|0', 'mdy', '15:15, January 30, 1991', 'Different year')

Different year
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'15:15, January 30, 1991'
+'21 years ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #6 ('20120101050000', '20120101080000', 'Offset|-360', 'mdy', 'Yesterday at 23:00', '"Yesterday" across years with time correction')

"Yesterday" across years with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Yesterday at 23:00'
+'3 hours ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #7 ('20120714184300', '20120716184300', 'Offset|-420', 'mdy', 'Saturday at 11:43', 'Recent weekday with time correction')

Recent weekday with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Saturday at 11:43'
+'2 days ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #8 ('20120714184300', '20120715040000', 'Offset|-420', 'mdy', '11:43', 'Today at another time with time correction')

Today at another time with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'11:43'
+'9 hours ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #9 ('20120617190900', '20120717190900', 'Offset|0', 'dmy', '17 June', 'Another month with dmy')

Another month with dmy
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'17 June'
+'1 month ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #10 ('20120617190900', '20120717190900', 'Offset|0', 'ISO 8601', '06-17', 'Another month with ISO-8601')

Another month with ISO-8601
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'06-17'
+'1 month ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

  1. TimestampTest::testHumanTimestamp with data set #11 ('19910130151500', '20120716193700', 'Offset|0', 'ISO 8601', '1991-01-30T15:15:00', 'Different year with ISO-8601')

Different year with ISO-8601
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'1991-01-30T15:15:00'
+'21 years ago'

/www/mediawiki/core/tests/phpunit/includes/TimestampTest.php:100
/www/mediawiki/core/tests/phpunit/MediaWikiTestCase.php:116
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:80
/www/mediawiki/core/tests/phpunit/MediaWikiPHPUnitCommand.php:64

FAILURES!
Tests: 45, Assertions: 55, Failures: 10.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=46541

Details

Reference
bz55886

Event Timeline

bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz55886.
bzimport added a subscriber: Unknown Object (MLST).
demon created this task.Oct 18 2013, 5:34 PM

Important difference between 2013.07 and 2013.09 releases here is,

+$wgHooks['GetHumanTimestamp'][] = 'TimeUnits::onGetHumanTimestamp';

ie Tests were added only 2013.08 release (and they fails in 2013.08 too).

The core tests should not run any hooks.

In addition it should perhaps be clarified what the getHumanTimestamp is expected to return. I've noticed some confusion and mixed expectations between absolute and relative expressions.

saper added a comment.Dec 5 2013, 10:58 AM

Can we skip testHumanTimestamp for now? Submitted gerrit change I161256bb46f6821b2223eff7ac85b1c80660b0c0 for this.

Just got this as well.

  1. MWTimestampTest::testHumanTimestamp with data set #0 ('20111231170000', '20120101000000', 'Offset|0', 'mdy', 'Yesterday at 17:00', '"Yesterday" across years')

"Yesterday" across years
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Yesterday at 17:00'
+'7 hours ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #1 ('20120717190900', '20120717190929', 'Offset|0', 'mdy', 'just now', '"Just now"')

"Just now"
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'just now'
+'29 seconds ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #4 ('20120617190900', '20120717190900', 'Offset|0', 'mdy', 'June 17', 'Another month')

Another month
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'June 17'
+'1 month ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #5 ('19910130151500', '20120716193700', 'Offset|0', 'mdy', '15:15, January 30, 1991', 'Different year')

Different year
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'15:15, January 30, 1991'
+'21 years ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #6 ('20120101050000', '20120101080000', 'Offset|-360', 'mdy', 'Yesterday at 23:00', '"Yesterday" across years with time correction')

"Yesterday" across years with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Yesterday at 23:00'
+'3 hours ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #7 ('20120714184300', '20120716184300', 'Offset|-420', 'mdy', 'Saturday at 11:43', 'Recent weekday with time correction')

Recent weekday with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'Saturday at 11:43'
+'2 days ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #8 ('20120714184300', '20120715040000', 'Offset|-420', 'mdy', '11:43', 'Today at another time with time correction')

Today at another time with time correction
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'11:43'
+'9 hours ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #9 ('20120617190900', '20120717190900', 'Offset|0', 'dmy', '17 June', 'Another month with dmy')

Another month with dmy
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'17 June'
+'1 month ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #10 ('20120617190900', '20120717190900', 'Offset|0', 'ISO 8601', '06-17', 'Another month with ISO-8601')

Another month with ISO-8601
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'06-17'
+'1 month ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

  1. MWTimestampTest::testHumanTimestamp with data set #11 ('19910130151500', '20120716193700', 'Offset|0', 'ISO 8601', '1991-01-30T15:15:00', 'Different year with ISO-8601')

Different year with ISO-8601
Failed asserting that two strings are equal.

  • Expected

+++ Actual
@@ @@
-'1991-01-30T15:15:00'
+'21 years ago'

/srv/vagrant/mediawiki/tests/phpunit/includes/MWTimestampTest.php:142
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
/srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
/srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160

Change 166751 had a related patch set uploaded by Umherirrender:
Avoid running of hooks when running MWTimestampTest

https://gerrit.wikimedia.org/r/166751

Change 166751 merged by jenkins-bot:
Avoid running of hooks when running MWTimestampTest

https://gerrit.wikimedia.org/r/166751