aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/XmlTest.php
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2023-06-02 18:42:49 +0100
committerTimo Tijhof <krinkle@fastmail.com>2023-06-02 20:17:23 +0100
commit4ac8637dfe065acf50a03c5873326903cb10a999 (patch)
treec2a6bdbeb35442ea6b368861792efce55f0d30cf /tests/phpunit/includes/XmlTest.php
parentee617eedae74b51a33c7b2874fb0a9783d7a1ffe (diff)
downloadmediawikicore-4ac8637dfe065acf50a03c5873326903cb10a999.tar.gz
mediawikicore-4ac8637dfe065acf50a03c5873326903cb10a999.zip
OutputPage,Html,Xml: Widen `@covers` annotations in unit tests
Follows-up I6d845bdfbb80, I69b5385868, I4c7d826c7e, I1287f3979ab, which widened the `@covers` annotations of other test suites: > We lose useful coverage and spend valuable time keeping these tags > accurate through refactors (or worse, forget to do so). > > I've audited each test to confirm it is a general test of the > subject class, where tagging missing methods would be an accepted > change, thus widening it is merely a no-op that clarifies intent > and reduces maintenance. I am not disabling the "only track coverage > of specified subject" mechanism, nor am I claiming coverage in > in classes outside the subject under test. > > Tracking this narrow detail wastes time to keep methods in sync during > refactors, time to realize (and fix) when other people inevitably > dodn't keep them in sync, time lost in finding uncovered code to > write tests for only to realize it is already covered but not tagged. Change-Id: I9d63105fd64b0a863d5bfaa67ae069c14531a4cf
Diffstat (limited to 'tests/phpunit/includes/XmlTest.php')
-rw-r--r--tests/phpunit/includes/XmlTest.php54
1 files changed, 2 insertions, 52 deletions
diff --git a/tests/phpunit/includes/XmlTest.php b/tests/phpunit/includes/XmlTest.php
index d595edfac832..ad5bfb3e4191 100644
--- a/tests/phpunit/includes/XmlTest.php
+++ b/tests/phpunit/includes/XmlTest.php
@@ -3,9 +3,10 @@
use MediaWiki\MainConfigNames;
/**
- * Split into separate \MediaWiki\Tests\Unit\XmlTest for unit tests
+ * See also \MediaWiki\Tests\Unit\XmlTest for the pure unit tests
*
* @group Xml
+ * @covers Xml
*/
class XmlTest extends MediaWikiIntegrationTestCase {
@@ -59,7 +60,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
}
/**
- * @covers Xml::element
* @dataProvider provideElement
*/
public function testElement( string $expect, string $element, $attribs, $content ) {
@@ -69,9 +69,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::input
- */
public function testElementInputCanHaveAValueOfZero() {
$this->assertEquals(
'<input name="name" value="0" />',
@@ -80,9 +77,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::openElement
- */
public function testOpenElement() {
$this->assertEquals(
'<element k="v">',
@@ -91,9 +85,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::closeElement
- */
public function testCloseElement() {
$this->assertEquals( '</element>', Xml::closeElement( 'element' ), 'closeElement() shortcut' );
}
@@ -139,7 +130,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
}
/**
- * @covers Xml::monthSelector
* @dataProvider provideMonthSelector
*/
public function testMonthSelector( $expected, $selected, $allmonths, $id ) {
@@ -149,9 +139,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::span
- */
public function testSpan() {
$this->assertEquals(
'<span class="foo" id="testSpan">element</span>',
@@ -159,9 +146,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::dateMenu
- */
public function testDateMenu() {
$curYear = intval( gmdate( 'Y' ) );
$prevYear = $curYear - 1;
@@ -251,9 +235,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::textarea
- */
public function testTextareaNoContent() {
$this->assertEquals(
'<textarea name="name" id="name" cols="40" rows="5"></textarea>',
@@ -262,9 +243,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::textarea
- */
public function testTextareaAttribs() {
$this->assertEquals(
'<textarea name="name" id="name" cols="20" rows="10">&lt;txt&gt;</textarea>',
@@ -273,9 +251,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::label
- */
public function testLabelCreation() {
$this->assertEquals(
'<label for="id">name</label>',
@@ -284,9 +259,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::label
- */
public function testLabelAttributeCanOnlyBeClassOrTitle() {
$this->assertEquals(
'<label for="id">name</label>',
@@ -316,9 +288,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::languageSelector
- */
public function testLanguageSelector() {
$select = Xml::languageSelector( 'en', true, null,
[ 'id' => 'testlang' ], wfMessage( 'yourlanguage' ) );
@@ -328,9 +297,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::listDropDown
- */
public function testListDropDown() {
$this->assertEquals(
'<select name="test-name" id="test-name" class="test-css" tabindex="2">' .
@@ -360,9 +326,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::listDropDownOptions
- */
public function testListDropDownOptions() {
$this->assertEquals(
[
@@ -383,9 +346,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::listDropDownOptions
- */
public function testListDropDownOptionsOthers() {
// Do not use the value for 'other' as option group - T251351
$this->assertEquals(
@@ -404,9 +364,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::listDropDownOptionsOoui
- */
public function testListDropDownOptionsOoui() {
$this->assertEquals(
[
@@ -462,7 +419,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
}
/**
- * @covers Xml::fieldset
* @dataProvider provideFieldset
*/
public function testFieldset( string $expect, array $args ) {
@@ -472,9 +428,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::buildTable
- */
public function testBuildTable() {
$firstRow = [ 'foo', 'bar' ];
$secondRow = [ 'Berlin', 'Tehran' ];
@@ -492,9 +445,6 @@ class XmlTest extends MediaWikiIntegrationTestCase {
);
}
- /**
- * @covers Xml::buildTableRow
- */
public function testBuildTableRow() {
$this->assertEquals(
'<tr id="testRow"><td>foo</td><td>bar</td></tr>',