summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/Providers.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-09-04 05:51:59 +0200
commit91e194556c52d2f354344f930419eef2dd6267f0 (patch)
tree0cd12490d3cd3499274017c9b799d0f738d3719e /tests/phpunit/includes/Providers.php
parent08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (diff)
Update to MediaWiki 1.21.2
Diffstat (limited to 'tests/phpunit/includes/Providers.php')
-rw-r--r--tests/phpunit/includes/Providers.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/phpunit/includes/Providers.php b/tests/phpunit/includes/Providers.php
new file mode 100644
index 00000000..948b6354
--- /dev/null
+++ b/tests/phpunit/includes/Providers.php
@@ -0,0 +1,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;
+ }
+}