Mailing List Archive

[MediaWiki-commits] [Gerrit] mediawiki...GeoData[master]: Add missing @covers tags to existing test cases
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406029 )

Change subject: Add missing @covers tags to existing test cases
......................................................................

Add missing @covers tags to existing test cases

I'm intentionally adding both class-level as well as function-level
@covers tags:
* I am adding function-level @covers when it is obvious a test case is
meant to test this single function only. Everything else would be
accidential coverage, which I don't want.
* I'm adding @covers on the class level when it is obvious which class
is under test. This is helpful because there are some test cases that
test a whole feature set of a class, and not only a specific method.
This is obviously not possible for "misc" test cases.

Change-Id: Ic7d5b8b2e81cf09753a2f7bf73dfd2304f69b1b6
---
M tests/phpunit/BoundingBoxTest.php
M tests/phpunit/CoordTest.php
M tests/phpunit/GeoDataMathTest.php
M tests/phpunit/GeoFeatureTest.php
M tests/phpunit/GeoSearchTest.php
M tests/phpunit/GlobeTest.php
M tests/phpunit/MiscGeoDataTest.php
M tests/phpunit/ParseCoordTest.php
M tests/phpunit/TagTest.php
9 files changed, 30 insertions(+), 1 deletion(-)


git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData refs/changes/29/406029/1

diff --git a/tests/phpunit/BoundingBoxTest.php b/tests/phpunit/BoundingBoxTest.php
index 29fc5fb..09cc178 100644
--- a/tests/phpunit/BoundingBoxTest.php
+++ b/tests/phpunit/BoundingBoxTest.php
@@ -6,10 +6,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\BoundingBox
+ *
* @group GeoData
*/
class BoundingBoxTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\BoundingBox::center
* @dataProvider provideCenter
*/
public function testCenter( $latExpected, $lonExpected, $lat1, $lon1, $lat2, $lon2 ) {
diff --git a/tests/phpunit/CoordTest.php b/tests/phpunit/CoordTest.php
index e8a52e7..a696415 100644
--- a/tests/phpunit/CoordTest.php
+++ b/tests/phpunit/CoordTest.php
@@ -8,12 +8,15 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Coord
+ *
* @todo: More tests
* @group GeoData
*/
class CoordTest extends MediaWikiTestCase {

/**
+ * @covers \GeoData\Coord::equalsTo
* @dataProvider provideEquals
* @param Coord $coord1
* @param Coord $coord2
@@ -112,6 +115,7 @@
}

/**
+ * @covers \GeoData\Coord::fullyEqualsTo
* @dataProvider provideFullyEquals
*
* @param Coord $coord1
@@ -237,6 +241,9 @@
return array_merge( $this->provideAlwaysEqualCoords(), $testCases );
}

+ /**
+ * @covers \GeoData\Coord::bboxAround
+ */
public function testBboxAround() {
for ( $i = 0; $i < 90; $i += 5 ) {
$coord = new Coord( $i, $i );
@@ -249,6 +256,7 @@
}

/**
+ * @covers \GeoData\Coord::getGlobeObj
* @dataProvider provideGlobeObj
*/
public function testGlobeObj( $name, Globe $expected ) {
diff --git a/tests/phpunit/GeoDataMathTest.php b/tests/phpunit/GeoDataMathTest.php
index d867f7c..0212609 100644
--- a/tests/phpunit/GeoDataMathTest.php
+++ b/tests/phpunit/GeoDataMathTest.php
@@ -7,10 +7,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Math
+ *
* @group GeoData
*/
class GeoDataMathTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\Math::distance
* @dataProvider getDistanceData
*/
public function testDistance( $lat1, $lon1, $lat2, $lon2, $dist, $name ) {
@@ -29,6 +32,8 @@
}

/**
+ * @covers \GeoData\Coord::bboxAround
+ * @covers \GeoData\Math::wrapAround
* @dataProvider getRectData
* @todo: test directly now that this function is public
*/
diff --git a/tests/phpunit/GeoFeatureTest.php b/tests/phpunit/GeoFeatureTest.php
index 2799887..3a76901 100644
--- a/tests/phpunit/GeoFeatureTest.php
+++ b/tests/phpunit/GeoFeatureTest.php
@@ -11,7 +11,7 @@
use Wikimedia\Rdbms\LoadBalancer;

/**
- * Test GeoFeature functions.
+ * @covers \GeoData\CirrusGeoFeature
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -93,6 +93,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseDistance
* @dataProvider parseDistanceProvider
*/
public function testParseDistance( $expected, $distance ) {
@@ -162,6 +163,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseGeoNearby
* @dataProvider parseGeoNearbyProvider
*/
public function testParseGeoNearby( $expected, $value ) {
@@ -244,6 +246,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseGeoNearbyTitle
* @dataProvider parseGeoNearbyTitleProvider
*/
public function testParseGeoNearbyTitle( $expected, $value ) {
diff --git a/tests/phpunit/GeoSearchTest.php b/tests/phpunit/GeoSearchTest.php
index 1966ec8..bc710f1 100644
--- a/tests/phpunit/GeoSearchTest.php
+++ b/tests/phpunit/GeoSearchTest.php
@@ -9,6 +9,8 @@
use ApiUsageException;

/**
+ * @covers \GeoData\ApiQueryGeoSearch
+ *
* @group GeoData
*/
class GeoSearchTest extends MediaWikiTestCase {
diff --git a/tests/phpunit/GlobeTest.php b/tests/phpunit/GlobeTest.php
index fb04c86..4d647f3 100644
--- a/tests/phpunit/GlobeTest.php
+++ b/tests/phpunit/GlobeTest.php
@@ -7,6 +7,8 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Globe
+ *
* @group GeoData
*/
class GlobeTest extends MediaWikiTestCase {
diff --git a/tests/phpunit/MiscGeoDataTest.php b/tests/phpunit/MiscGeoDataTest.php
index 40e9d11..2d79b0f 100644
--- a/tests/phpunit/MiscGeoDataTest.php
+++ b/tests/phpunit/MiscGeoDataTest.php
@@ -10,6 +10,7 @@
*/
class MiscGeoDataTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\ApiQueryGeoSearchDb::intRange
* @dataProvider getIntRangeData
*/
public function testIntRange( $min, $max, $expected ) {
diff --git a/tests/phpunit/ParseCoordTest.php b/tests/phpunit/ParseCoordTest.php
index 6610853..db469e4 100644
--- a/tests/phpunit/ParseCoordTest.php
+++ b/tests/phpunit/ParseCoordTest.php
@@ -8,10 +8,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\CoordinatesParserFunction
+ *
* @group GeoData
*/
class ParseCoordTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\CoordinatesParserFunction::parseCoordinates
* @dataProvider getCases
*/
public function testParseCoordinates( $parts, $result, $globe = 'earth' ) {
diff --git a/tests/phpunit/TagTest.php b/tests/phpunit/TagTest.php
index e33a413..2c90667 100644
--- a/tests/phpunit/TagTest.php
+++ b/tests/phpunit/TagTest.php
@@ -9,6 +9,8 @@
use Title;

/**
+ * @covers \GeoData\CoordinatesParserFunction
+ *
* @group GeoData
*/
class TagTest extends MediaWikiTestCase {

--
To view, visit https://gerrit.wikimedia.org/r/406029
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7d5b8b2e81cf09753a2f7bf73dfd2304f69b1b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...GeoData[master]: Add missing @covers tags to existing test cases [ In reply to ]
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/406029 )

Change subject: Add missing @covers tags to existing test cases
......................................................................


Add missing @covers tags to existing test cases

I'm intentionally adding both class-level as well as function-level
@covers tags:
* I am adding function-level @covers when it is obvious a test case is
meant to test this single function only. Everything else would be
accidential coverage, which I don't want.
* I'm adding @covers on the class level when it is obvious which class
is under test. This is helpful because there are some test cases that
test a whole feature set of a class, and not only a specific method.
This is obviously not possible for "misc" test cases.

Change-Id: Ic7d5b8b2e81cf09753a2f7bf73dfd2304f69b1b6
---
M tests/phpunit/BoundingBoxTest.php
M tests/phpunit/CoordTest.php
M tests/phpunit/GeoDataMathTest.php
M tests/phpunit/GeoFeatureTest.php
M tests/phpunit/GeoSearchTest.php
M tests/phpunit/GlobeTest.php
M tests/phpunit/MiscGeoDataTest.php
M tests/phpunit/ParseCoordTest.php
M tests/phpunit/TagTest.php
9 files changed, 30 insertions(+), 1 deletion(-)

Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified



diff --git a/tests/phpunit/BoundingBoxTest.php b/tests/phpunit/BoundingBoxTest.php
index 29fc5fb..09cc178 100644
--- a/tests/phpunit/BoundingBoxTest.php
+++ b/tests/phpunit/BoundingBoxTest.php
@@ -6,10 +6,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\BoundingBox
+ *
* @group GeoData
*/
class BoundingBoxTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\BoundingBox::center
* @dataProvider provideCenter
*/
public function testCenter( $latExpected, $lonExpected, $lat1, $lon1, $lat2, $lon2 ) {
diff --git a/tests/phpunit/CoordTest.php b/tests/phpunit/CoordTest.php
index e8a52e7..a696415 100644
--- a/tests/phpunit/CoordTest.php
+++ b/tests/phpunit/CoordTest.php
@@ -8,12 +8,15 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Coord
+ *
* @todo: More tests
* @group GeoData
*/
class CoordTest extends MediaWikiTestCase {

/**
+ * @covers \GeoData\Coord::equalsTo
* @dataProvider provideEquals
* @param Coord $coord1
* @param Coord $coord2
@@ -112,6 +115,7 @@
}

/**
+ * @covers \GeoData\Coord::fullyEqualsTo
* @dataProvider provideFullyEquals
*
* @param Coord $coord1
@@ -237,6 +241,9 @@
return array_merge( $this->provideAlwaysEqualCoords(), $testCases );
}

+ /**
+ * @covers \GeoData\Coord::bboxAround
+ */
public function testBboxAround() {
for ( $i = 0; $i < 90; $i += 5 ) {
$coord = new Coord( $i, $i );
@@ -249,6 +256,7 @@
}

/**
+ * @covers \GeoData\Coord::getGlobeObj
* @dataProvider provideGlobeObj
*/
public function testGlobeObj( $name, Globe $expected ) {
diff --git a/tests/phpunit/GeoDataMathTest.php b/tests/phpunit/GeoDataMathTest.php
index d867f7c..0212609 100644
--- a/tests/phpunit/GeoDataMathTest.php
+++ b/tests/phpunit/GeoDataMathTest.php
@@ -7,10 +7,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Math
+ *
* @group GeoData
*/
class GeoDataMathTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\Math::distance
* @dataProvider getDistanceData
*/
public function testDistance( $lat1, $lon1, $lat2, $lon2, $dist, $name ) {
@@ -29,6 +32,8 @@
}

/**
+ * @covers \GeoData\Coord::bboxAround
+ * @covers \GeoData\Math::wrapAround
* @dataProvider getRectData
* @todo: test directly now that this function is public
*/
diff --git a/tests/phpunit/GeoFeatureTest.php b/tests/phpunit/GeoFeatureTest.php
index 2799887..3a76901 100644
--- a/tests/phpunit/GeoFeatureTest.php
+++ b/tests/phpunit/GeoFeatureTest.php
@@ -11,7 +11,7 @@
use Wikimedia\Rdbms\LoadBalancer;

/**
- * Test GeoFeature functions.
+ * @covers \GeoData\CirrusGeoFeature
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -93,6 +93,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseDistance
* @dataProvider parseDistanceProvider
*/
public function testParseDistance( $expected, $distance ) {
@@ -162,6 +163,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseGeoNearby
* @dataProvider parseGeoNearbyProvider
*/
public function testParseGeoNearby( $expected, $value ) {
@@ -244,6 +246,7 @@
}

/**
+ * @covers \GeoData\CirrusGeoFeature::parseGeoNearbyTitle
* @dataProvider parseGeoNearbyTitleProvider
*/
public function testParseGeoNearbyTitle( $expected, $value ) {
diff --git a/tests/phpunit/GeoSearchTest.php b/tests/phpunit/GeoSearchTest.php
index 1966ec8..bc710f1 100644
--- a/tests/phpunit/GeoSearchTest.php
+++ b/tests/phpunit/GeoSearchTest.php
@@ -9,6 +9,8 @@
use ApiUsageException;

/**
+ * @covers \GeoData\ApiQueryGeoSearch
+ *
* @group GeoData
*/
class GeoSearchTest extends MediaWikiTestCase {
diff --git a/tests/phpunit/GlobeTest.php b/tests/phpunit/GlobeTest.php
index fb04c86..4d647f3 100644
--- a/tests/phpunit/GlobeTest.php
+++ b/tests/phpunit/GlobeTest.php
@@ -7,6 +7,8 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\Globe
+ *
* @group GeoData
*/
class GlobeTest extends MediaWikiTestCase {
diff --git a/tests/phpunit/MiscGeoDataTest.php b/tests/phpunit/MiscGeoDataTest.php
index 40e9d11..2d79b0f 100644
--- a/tests/phpunit/MiscGeoDataTest.php
+++ b/tests/phpunit/MiscGeoDataTest.php
@@ -10,6 +10,7 @@
*/
class MiscGeoDataTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\ApiQueryGeoSearchDb::intRange
* @dataProvider getIntRangeData
*/
public function testIntRange( $min, $max, $expected ) {
diff --git a/tests/phpunit/ParseCoordTest.php b/tests/phpunit/ParseCoordTest.php
index 6610853..db469e4 100644
--- a/tests/phpunit/ParseCoordTest.php
+++ b/tests/phpunit/ParseCoordTest.php
@@ -8,10 +8,13 @@
use MediaWikiTestCase;

/**
+ * @covers \GeoData\CoordinatesParserFunction
+ *
* @group GeoData
*/
class ParseCoordTest extends MediaWikiTestCase {
/**
+ * @covers \GeoData\CoordinatesParserFunction::parseCoordinates
* @dataProvider getCases
*/
public function testParseCoordinates( $parts, $result, $globe = 'earth' ) {
diff --git a/tests/phpunit/TagTest.php b/tests/phpunit/TagTest.php
index e33a413..2c90667 100644
--- a/tests/phpunit/TagTest.php
+++ b/tests/phpunit/TagTest.php
@@ -9,6 +9,8 @@
use Title;

/**
+ * @covers \GeoData\CoordinatesParserFunction
+ *
* @group GeoData
*/
class TagTest extends MediaWikiTestCase {

--
To view, visit https://gerrit.wikimedia.org/r/406029
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic7d5b8b2e81cf09753a2f7bf73dfd2304f69b1b6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de>
Gerrit-Reviewer: Ladsgroup <Ladsgroup@gmail.com>
Gerrit-Reviewer: MaxSem <maxsem.wiki@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits