Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / tests / phpunit / includes / media / XMPValidateTest.php
blob96bf5e4781ce9f6a57ec26260485ca68c39cce67
1 <?php
2 class XMPValidateTest extends MediaWikiTestCase {
4 /**
5 * @dataProvider provideDates
6 * @covers XMPValidate::validateDate
7 */
8 public function testValidateDate( $value, $expected ) {
9 // The method should modify $value.
10 XMPValidate::validateDate( array(), $value, true );
11 $this->assertEquals( $expected, $value );
14 public static function provideDates() {
15 /* For reference valid date formats are:
16 * YYYY
17 * YYYY-MM
18 * YYYY-MM-DD
19 * YYYY-MM-DDThh:mmTZD
20 * YYYY-MM-DDThh:mm:ssTZD
21 * YYYY-MM-DDThh:mm:ss.sTZD
22 * (Time zone is optional)
24 return array(
25 array( '1992', '1992' ),
26 array( '1992-04', '1992:04' ),
27 array( '1992-02-01', '1992:02:01' ),
28 array( '2011-09-29', '2011:09:29' ),
29 array( '1982-12-15T20:12', '1982:12:15 20:12' ),
30 array( '1982-12-15T20:12Z', '1982:12:15 20:12' ),
31 array( '1982-12-15T20:12+02:30', '1982:12:15 22:42' ),
32 array( '1982-12-15T01:12-02:30', '1982:12:14 22:42' ),
33 array( '1982-12-15T20:12:11', '1982:12:15 20:12:11' ),
34 array( '1982-12-15T20:12:11Z', '1982:12:15 20:12:11' ),
35 array( '1982-12-15T20:12:11+01:10', '1982:12:15 21:22:11' ),
36 array( '2045-12-15T20:12:11', '2045:12:15 20:12:11' ),
37 array( '1867-06-01T15:00:00', '1867:06:01 15:00:00' ),
38 /* some invalid ones */
39 array( '2001--12', null ),
40 array( '2001-5-12', null ),
41 array( '2001-5-12TZ', null ),
42 array( '2001-05-12T15', null ),
43 array( '2001-12T15:13', null ),