+ public function provideMonthSelector() {
+ global $wgLang;
+
+ $header = '<select name="month" id="month" class="mw-month-selector">';
+ $header2 = '<select name="month" id="monthSelector" class="mw-month-selector">';
+ $monthsString = '';
+ for ( $i = 1; $i < 13; $i++ ) {
+ $monthName = $wgLang->getMonthName( $i );
+ $monthsString .= "<option value=\"{$i}\">{$monthName}</option>";
+ if ( $i !== 12 ) {
+ $monthsString .= "\n";
+ }
+ }
+ $monthsString2 = str_replace(
+ '<option value="12">December</option>',
+ '<option value="12" selected="">December</option>',
+ $monthsString
+ );
+ $end = '</select>';
+
+ $allMonths = "<option value=\"AllMonths\">all</option>\n";
+ return [
+ [ $header . $monthsString . $end, '', null, 'month' ],
+ [ $header . $monthsString2 . $end, 12, null, 'month' ],
+ [ $header2 . $monthsString . $end, '', null, 'monthSelector' ],
+ [ $header . $allMonths . $monthsString . $end, '', 'AllMonths', 'month' ],
+
+ ];
+ }
+
+ /**
+ * @covers Xml::monthSelector
+ * @dataProvider provideMonthSelector
+ */
+ public function testMonthSelector( $expected, $selected, $allmonths, $id ) {
+ $this->assertEquals(
+ $expected,
+ Xml::monthSelector( $selected, $allmonths, $id )
+ );
+ }
+
+ /**
+ * @covers Xml::span
+ */
+ public function testSpan() {
+ $this->assertEquals(
+ '<span class="foo" id="testSpan">element</span>',
+ Xml::span( 'element', 'foo', [ 'id' => 'testSpan' ] )
+ );
+ }
+