~ubuntu-branches/ubuntu/trusty/mediawiki/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/phpunit/includes/Providers.php

  • Committer: Package Import Robot
  • Author(s): Thorsten Glaser
  • Date: 2014-03-28 09:56:29 UTC
  • mfrom: (1.3.14)
  • Revision ID: package-import@ubuntu.com-20140328095629-1526y9tchdd507id
Tags: 1:1.19.14+dfsg-1
* New upstream security fix release (Closes: #742857):
  - (bug 62497) SECURITY: Add CSRF token on Special:ChangePassword
  - (bug 62467) Set a title for the context during import on the cli
* Use upstream-provided signing key bundle

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Generic providers for the MediaWiki PHPUnit test suite
 
4
 *
 
5
 * @author Antoine Musso
 
6
 * @copyright Copyright © 2011, Antoine Musso
 
7
 * @file
 
8
 */
 
9
 
 
10
/** */
 
11
class MediaWikiProvide {
 
12
 
 
13
        /* provide an array of numbers from 1 up to @param $num */
 
14
        private static function createProviderUpTo( $num ) {
 
15
                $ret = array();
 
16
                for( $i=1; $i<=$num;$i++ ) {
 
17
                        $ret[] = array( $i );
 
18
                }
 
19
                return $ret;
 
20
        }
 
21
 
 
22
        /* array of months numbers (as an integer) */
 
23
        public static function Months() {
 
24
                return self::createProviderUpTo( 12 );
 
25
        }
 
26
 
 
27
        /* array of days numbers (as an integer) */
 
28
        public static function Days() {
 
29
                return self::createProviderUpTo( 31 );
 
30
        }
 
31
 
 
32
        public static function DaysMonths() {
 
33
                $ret = array();
 
34
 
 
35
                $months = self::Months();
 
36
                $days   = self::Days();
 
37
                foreach( $months as $month) {
 
38
                        foreach( $days as $day ) {
 
39
                                $ret[] = array( $day[0], $month[0] );
 
40
                        }
 
41
                }
 
42
                return $ret;
 
43
        }
 
44
}