summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/Providers.php
blob: f451f8a0daed71f82530bb02ee6eea810571af00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
 * Generic providers for the MediaWiki PHPUnit test suite
 *
 * @author Antoine Musso
 * @copyright Copyright © 2011, Antoine Musso
 * @file
 */

/** */
class MediaWikiProvide {

	/* provide an array of numbers from 1 up to @param $num */
	private static function createProviderUpTo( $num ) {
		$ret = array();
		for( $i=1; $i<=$num;$i++ ) {
			$ret[] = array( $i );
		}
		return $ret;
	}

	/* array of months numbers (as an integer) */
	public static function Months() {
		return self::createProviderUpTo( 12 );
	}

	/* array of days numbers (as an integer) */
	public static function Days() {
		return self::createProviderUpTo( 31 );
	}

	public static function DaysMonths() {
		$ret = array();

		$months = self::Months();
		$days   = self::Days();
		foreach( $months as $month) {
			foreach( $days as $day ) {
				$ret[] = array( $day[0], $month[0] );
			}
		}
		return $ret;
	}
}