Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/356663 )
Change subject: Break long lines ...................................................................... Break long lines Prepare to make phpcs pass Change-Id: I5a087a1f40368deaa6110663d541c414d369f95c --- M includes/BoundingBox.php M includes/CoordinatesParserFunction.php M includes/Hooks.php M includes/Math.php M includes/api/ApiQueryCoordinates.php M maintenance/updateIndexGranularity.php M tests/phpunit/CoordTest.php M tests/phpunit/GeoDataMathTest.php M tests/phpunit/GeoSearchTest.php M tests/phpunit/ParseCoordTest.php M tests/phpunit/TagTest.php 11 files changed, 251 insertions(+), 63 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GeoData refs/changes/63/356663/1 diff --git a/includes/BoundingBox.php b/includes/BoundingBox.php index d497759..f99a2ac 100644 --- a/includes/BoundingBox.php +++ b/includes/BoundingBox.php @@ -26,7 +26,8 @@ * @return BoundingBox */ public static function newFromPoints( Coord $topLeft, Coord $bottomRight ) { - return new self( $topLeft->lat, $topLeft->lon, $bottomRight->lat, $bottomRight->lon, $topLeft->globe ); + return new self( $topLeft->lat, $topLeft->lon, $bottomRight->lat, $bottomRight->lon, + $topLeft->globe ); } public function topLeft() { diff --git a/includes/CoordinatesParserFunction.php b/includes/CoordinatesParserFunction.php index 81aa5f1..4257761 100644 --- a/includes/CoordinatesParserFunction.php +++ b/includes/CoordinatesParserFunction.php @@ -143,9 +143,12 @@ */ private function processArgs() { global $wgDefaultGlobe, $wgContLang; - // fear not of overwriting the stuff we've just received from the geohack param, it has minimum precedence + // fear not of overwriting the stuff we've just received from the geohack param, + // it has minimum precedence if ( isset( $this->named['geohack'] ) ) { - $this->named = array_merge( $this->parseGeoHackArgs( $this->named['geohack'] ), $this->named ); + $this->named = array_merge( + $this->parseGeoHackArgs( $this->named['geohack'] ), $this->named + ); } $globe = ( isset( $this->named['globe'] ) && $this->named['globe'] ) ? $wgContLang->lc( $this->named['globe'] ) @@ -211,7 +214,8 @@ private function parseGeoHackArgs( $str ) { $result = []; - $str = str_replace( '_', ' ', $str ); // per GeoHack docs, spaces and underscores are equivalent + // per GeoHack docs, spaces and underscores are equivalent + $str = str_replace( '_', ' ', $str ); $parts = explode( ' ', $str ); foreach ( $parts as $arg ) { $keyVal = explode( ':', $arg, 2 ); diff --git a/includes/Hooks.php b/includes/Hooks.php index 09e8255..d59cd7d 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -46,14 +46,17 @@ if ( $wgGeoDataBackend != 'db' ) { $updater->addExtensionTable( 'geo_tags', "$dir/../sql/externally-backed.sql" ); - $updater->dropExtensionTable( 'geo_killlist', "$dir/../sql/drop-updates-killlist.sql" ); + $updater->dropExtensionTable( 'geo_killlist', + "$dir/../sql/drop-updates-killlist.sql" ); } else { $updater->addExtensionTable( 'geo_tags', "$dir/../sql/db-backed.sql" ); } $updater->addExtensionUpdate( [ 'GeoData\Hooks::upgradeToDecimal' ] ); break; default: - throw new MWException( 'GeoData extension currently supports only MySQL and SQLite' ); + throw new MWException( + 'GeoData extension currently supports only MySQL and SQLite' + ); } } @@ -140,7 +143,9 @@ $metadata = unserialize( $metadata ); \MediaWiki\restoreWarnings(); - if ( isset( $metadata ) && isset( $metadata['GPSLatitude'] ) && isset( $metadata['GPSLongitude'] ) ) { + if ( isset( $metadata ) && isset( $metadata['GPSLatitude'] ) + && isset( $metadata['GPSLongitude'] ) + ) { $lat = $metadata['GPSLatitude']; $lon = $metadata['GPSLongitude']; $globe = new Globe( 'earth' ); @@ -216,7 +221,9 @@ $po = $wp->makeParserOptions( $wgUser ); $pout = $wp->getParserOutput( $po ); if ( !$pout ) { - wfDebugLog( 'mobile', __METHOD__ . "(): no parser output returned for file {$file->getName()}" ); + wfDebugLog( 'mobile', + __METHOD__ . "(): no parser output returned for file {$file->getName()}" + ); } else { // Make sure this has outer transaction scope (though the hook fires // in a deferred AutoCommitUdpate update, so it should be safe anyway). @@ -270,7 +277,8 @@ /** * @var \CirrusSearch $engine */ - $fields['coordinates'] = CoordinatesIndexField::build( 'coordinates', $engine->getConfig(), $engine ); + $fields['coordinates'] = CoordinatesIndexField::build( + 'coordinates', $engine->getConfig(), $engine ); } else { // Unsupported SearchEngine or explicitly disabled by config } diff --git a/includes/Math.php b/includes/Math.php index 704573b..3a751d1 100644 --- a/includes/Math.php +++ b/includes/Math.php @@ -29,7 +29,8 @@ $lon2 = deg2rad( $lon2 ); $sin1 = sin( ( $lat2 - $lat1 ) / 2 ); $sin2 = sin( ( $lon2 - $lon1 ) / 2 ); - return 2 * self::EARTH_RADIUS * asin( sqrt( $sin1 * $sin1 + cos( $lat1 ) * cos( $lat2 ) * $sin2 * $sin2 ) ); + return 2 * self::EARTH_RADIUS * + asin( sqrt( $sin1 * $sin1 + cos( $lat1 ) * cos( $lat2 ) * $sin2 * $sin2 ) ); } /** diff --git a/includes/api/ApiQueryCoordinates.php b/includes/api/ApiQueryCoordinates.php index 345b301..706882a 100644 --- a/includes/api/ApiQueryCoordinates.php +++ b/includes/api/ApiQueryCoordinates.php @@ -8,7 +8,8 @@ use Title; /** - * This query adds an <coordinates> subelement to all pages with the list of coordinated present on those pages. + * This query adds an <coordinates> subelement to all pages with the list of coordinated + * present on those pages. */ class ApiQueryCoordinates extends ApiQueryBase { @@ -34,7 +35,9 @@ } $this->addWhereFld( 'gt_page_id', array_keys( $titles ) ); $primary = $params['primary']; - $this->addWhereIf( [ 'gt_primary' => intval( $primary === 'primary' ) ], $primary !== 'all' ); + $this->addWhereIf( + [ 'gt_primary' => intval( $primary === 'primary' ) ], $primary !== 'all' + ); if ( isset( $params['continue'] ) ) { $parts = explode( '|', $params['continue'] ); @@ -113,7 +116,10 @@ $coord = GeoData::getPageCoordinates( $title ); if ( !$coord ) { $this->dieWithError( - [ 'apierror-geodata-noprimarycoord', wfEscapeWikiText( $title->getPrefixedText() ) ], + [ + 'apierror-geodata-noprimarycoord', + wfEscapeWikiText( $title->getPrefixedText() ) + ], 'no-coordinates' ); } diff --git a/maintenance/updateIndexGranularity.php b/maintenance/updateIndexGranularity.php index fe85284..39b8a1a 100644 --- a/maintenance/updateIndexGranularity.php +++ b/maintenance/updateIndexGranularity.php @@ -12,7 +12,8 @@ public function __construct() { parent::__construct(); - $this->mDescription = 'Updates GeoData database after $wgGeoDataIndexGranularity has been changed'; + $this->mDescription = + 'Updates GeoData database after $wgGeoDataIndexGranularity has been changed'; $this->requireExtension( 'GeoData' ); } diff --git a/tests/phpunit/CoordTest.php b/tests/phpunit/CoordTest.php index ec02b76..e8a52e7 100644 --- a/tests/phpunit/CoordTest.php +++ b/tests/phpunit/CoordTest.php @@ -30,8 +30,10 @@ public function provideEquals() { $testCases = [ [ - new Coord( 10, 20, null, [ 'dim' => 123, 'type' => 'not', 'country' => 'not', 'primary' => true, 'name' => 'not' ] ), - new Coord( 10, 20, null, [ 'dim' => 456, 'type' => 'equal', 'country' => 'equal', 'primary' => false, 'name' => 'equal' ] ), + new Coord( 10, 20, null, [ 'dim' => 123, 'type' => 'not', 'country' => 'not', + 'primary' => true, 'name' => 'not' ] ), + new Coord( 10, 20, null, [ 'dim' => 456, 'type' => 'equal', 'country' => 'equal', + 'primary' => false, 'name' => 'equal' ] ), true, 'Equality with other fileds differing', ], @@ -41,17 +43,71 @@ private function provideAlwaysEqualCoords() { return [ - [ new Coord( 10, 20 ), new Coord( 10, 20 ), true, 'Basic equality' ], - [ new Coord( 10, 20 ), new Coord( 10.0, 20.00000000000001 ), true, 'Basic equality 2: compare floats with ints' ], - [ new Coord( 10, 20 ), new Coord( 123, 20 ), false, 'Basic inequality: lat' ], - [ new Coord( 10, 20 ), new Coord( 10, 123 ), false, 'Basic inequality: lon' ], - [ new Coord( 10, 20, 'endor' ), new Coord( 10, 20, 'endor' ), true, 'Equality with globe set' ], - [ new Coord( 10, 20, 'earth' ), new Coord( 10, 20, 'moon' ), false, 'Inequality due to globe' ], - [ new Coord( 10, 20, 'yavin' ), new Coord( 0, 0, 'yavin' ), false, 'Inequality with globes equal' ], - [ new Coord( 10, 20 ), new Coord( 10.1, 20 ), false, 'Precision 1' ], - [ new Coord( 10, 20 ), new Coord( 10, 20.0000001 ), true, 'Precision 2' ], - [ new Coord( 10, 20 ), null, false, 'Comparison with null' ], - [ new Coord( 10, 20, '01' ), new Coord( 10, 20, '1' ), false, 'Compare globes strictly' ], + [ + new Coord( 10, 20 ), + new Coord( 10, 20 ), + true, + 'Basic equality' + ], + [ + new Coord( 10, 20 ), + new Coord( 10.0, 20.00000000000001 ), + true, + 'Basic equality 2: compare floats with ints' + ], + [ + new Coord( 10, 20 ), + new Coord( 123, 20 ), + false, + 'Basic inequality: lat' + ], + [ + new Coord( 10, 20 ), + new Coord( 10, 123 ), + false, + 'Basic inequality: lon' + ], + [ + new Coord( 10, 20, 'endor' ), + new Coord( 10, 20, 'endor' ), + true, + 'Equality with globe set' + ], + [ + new Coord( 10, 20, 'earth' ), + new Coord( 10, 20, 'moon' ), + false, + 'Inequality due to globe' + ], + [ + new Coord( 10, 20, 'yavin' ), + new Coord( 0, 0, 'yavin' ), false, + 'Inequality with globes equal' + ], + [ + new Coord( 10, 20 ), + new Coord( 10.1, 20 ), + false, + 'Precision 1' + ], + [ + new Coord( 10, 20 ), + new Coord( 10, 20.0000001 ), + true, + 'Precision 2' + ], + [ + new Coord( 10, 20 ), + null, + false, + 'Comparison with null' + ], + [ + new Coord( 10, 20, '01' ), + new Coord( 10, 20, '1' ), + false, + 'Compare globes strictly' + ], ]; } @@ -72,25 +128,110 @@ public function provideFullyEquals() { $testCases = [ - [ new Coord( 10, 20, null, [ 'primary' => true ] ), new Coord( 10, 20, null, [ 'primary' => false ] ), false, 'Strict inequality: primary' ], - [ new Coord( 10, 20, null, [ 'dim' => 123 ] ), new Coord( 10, 20, null, [ 'dim' => 456 ] ), false, 'Strict inequality: dim' ], - [ new Coord( 10, 20, null, [ 'type' => 'not' ] ), new Coord( 10, 20, null, [ 'type' => 'equal' ] ), false, 'Strict inequality: type' ], - [ new Coord( 10, 20, null, [ 'name' => 'not' ] ), new Coord( 10, 20, null, [ 'name' => 'equal' ] ), false, 'Strict inequality: name' ], - [ new Coord( 10, 20, null, [ 'country' => 'not' ] ), new Coord( 10, 20, null, [ 'country' => 'equal' ] ), false, 'Strict inequality: country' ], - [ new Coord( 10, 20, null, [ 'region' => 'not' ] ), new Coord( 10, 20, null, [ 'region' => 'equal' ] ), false, 'Strict inequality: region' ], + [ + new Coord( 10, 20, null, [ 'primary' => true ] ), + new Coord( 10, 20, null, [ 'primary' => false ] ), + false, + 'Strict inequality: primary' + ], + [ + new Coord( 10, 20, null, [ 'dim' => 123 ] ), + new Coord( 10, 20, null, [ 'dim' => 456 ] ), + false, + 'Strict inequality: dim' + ], + [ + new Coord( 10, 20, null, [ 'type' => 'not' ] ), + new Coord( 10, 20, null, [ 'type' => 'equal' ] ), + false, + 'Strict inequality: type' + ], + [ + new Coord( 10, 20, null, [ 'name' => 'not' ] ), + new Coord( 10, 20, null, [ 'name' => 'equal' ] ), + false, + 'Strict inequality: name' + ], + [ + new Coord( 10, 20, null, [ 'country' => 'not' ] ), + new Coord( 10, 20, null, [ 'country' => 'equal' ] ), + false, + 'Strict inequality: country' + ], + [ + new Coord( 10, 20, null, [ 'region' => 'not' ] ), + new Coord( 10, 20, null, [ 'region' => 'equal' ] ), + false, + 'Strict inequality: region' + ], // Now make sure comparison is type-aware when needed - [ new Coord( 10, 20, null, [ 'primary' => 'yes' ] ), new Coord( 10, 20, null, [ 'primary' => true ] ), true, 'Strict inequality: compare primary as booleanish' ], - [ new Coord( 10, 20, null, [ 'dim' => 123 ] ), new Coord( 10, 20, null, [ 'dim' => 123.0 ] ), false, 'Strict inequality: dim' ], - [ new Coord( 10, 20, null, [ 'type' => '01' ] ), new Coord( 10, 20, null, [ 'type' => '1' ] ), false, 'Strict inequality: type' ], - [ new Coord( 10, 20, null, [ 'name' => '01' ] ), new Coord( 10, 20, null, [ 'name' => '1' ] ), false, 'Strict inequality: name' ], - [ new Coord( 10, 20, null, [ 'country' => '01' ] ), new Coord( 10, 20, null, [ 'country' => '1' ] ), false, 'Strict inequality: country' ], - [ new Coord( 10, 20, null, [ 'region' => '01' ] ), new Coord( 10, 20, null, [ 'region' => '1' ] ), false, 'Strict inequality: region' ], + [ + new Coord( 10, 20, null, [ 'primary' => 'yes' ] ), + new Coord( 10, 20, null, [ 'primary' => true ] ), + true, + 'Strict inequality: compare primary as booleanish' + ], + [ + new Coord( 10, 20, null, [ 'dim' => 123 ] ), + new Coord( 10, 20, null, [ 'dim' => 123.0 ] ), + false, + 'Strict inequality: dim' + ], + [ + new Coord( 10, 20, null, [ 'type' => '01' ] ), + new Coord( 10, 20, null, [ 'type' => '1' ] ), + false, + 'Strict inequality: type' + ], + [ + new Coord( 10, 20, null, [ 'name' => '01' ] ), + new Coord( 10, 20, null, [ 'name' => '1' ] ), + false, + 'Strict inequality: name' + ], + [ + new Coord( 10, 20, null, [ 'country' => '01' ] ), + new Coord( 10, 20, null, [ 'country' => '1' ] ), + false, + 'Strict inequality: country' + ], + [ + new Coord( 10, 20, null, [ 'region' => '01' ] ), + new Coord( 10, 20, null, [ 'region' => '1' ] ), + false, + 'Strict inequality: region' + ], // Null must never match anything - [ new Coord( 10, 20, null, [ 'dim' => 0 ] ), new Coord( 10, 20, null, [ 'dim' => null ] ), false, 'Strict inequality: dim comparison with null' ], - [ new Coord( 10, 20, null, [ 'type' => '' ] ), new Coord( 10, 20, null, [ 'type' => null ] ), false, 'Strict inequality: type comparison with null' ], - [ new Coord( 10, 20, null, [ 'name' => '' ] ), new Coord( 10, 20, null, [ 'name' => null ] ), false, 'Strict inequality: name comparison with null' ], - [ new Coord( 10, 20, null, [ 'country' => '0' ] ), new Coord( 10, 20, null, [ 'country' => null ] ), false, 'Strict inequality: country comparison with null' ], - [ new Coord( 10, 20, null, [ 'region' => '0' ] ), new Coord( 10, 20, null, [ 'region' => null ] ), false, 'Strict inequality: region comparison with null' ], + [ + new Coord( 10, 20, null, [ 'dim' => 0 ] ), + new Coord( 10, 20, null, [ 'dim' => null ] ), + false, + 'Strict inequality: dim comparison with null' + ], + [ + new Coord( 10, 20, null, [ 'type' => '' ] ), + new Coord( 10, 20, null, [ 'type' => null ] ), + false, + 'Strict inequality: type comparison with null' + ], + [ + new Coord( 10, 20, null, [ 'name' => '' ] ), + new Coord( 10, 20, null, [ 'name' => null ] ), + false, + 'Strict inequality: name comparison with null' + ], + [ + new Coord( 10, 20, null, [ 'country' => '0' ] ), + new Coord( 10, 20, null, [ 'country' => null ] ), + false, + 'Strict inequality: country comparison with null' + ], + [ + new Coord( 10, 20, null, [ 'region' => '0' ] ), + new Coord( 10, 20, null, [ 'region' => null ] ), + false, + 'Strict inequality: region comparison with null' + ], ]; return array_merge( $this->provideAlwaysEqualCoords(), $testCases ); @@ -100,8 +241,10 @@ for ( $i = 0; $i < 90; $i += 5 ) { $coord = new Coord( $i, $i ); $bbox = $coord->bboxAround( 5000 ); - $this->assertEquals( 10000, Math::distance( $bbox->lat1, $i, $bbox->lat2, $i ), 'Testing latitude', 1 ); - $this->assertEquals( 10000, Math::distance( $i, $bbox->lon1, $i, $bbox->lon2 ), 'Testing longitude', 1 ); + $this->assertEquals( 10000, Math::distance( $bbox->lat1, $i, $bbox->lat2, $i ), + 'Testing latitude', 1 ); + $this->assertEquals( 10000, Math::distance( $i, $bbox->lon1, $i, $bbox->lon2 ), + 'Testing longitude', 1 ); } } @@ -121,4 +264,4 @@ [ 'something nonexistent', new Globe( 'something nonexistent' ) ], ]; } -} \ No newline at end of file +} diff --git a/tests/phpunit/GeoDataMathTest.php b/tests/phpunit/GeoDataMathTest.php index 1ea82c5..d867f7c 100644 --- a/tests/phpunit/GeoDataMathTest.php +++ b/tests/phpunit/GeoDataMathTest.php @@ -14,7 +14,8 @@ * @dataProvider getDistanceData */ public function testDistance( $lat1, $lon1, $lat2, $lon2, $dist, $name ) { - $this->assertEquals( $dist, Math::distance( $lat1, $lon1, $lat2, $lon2 ), "testDistance(): $name", $dist / 1000 ); + $this->assertEquals( $dist, Math::distance( $lat1, $lon1, $lat2, $lon2 ), + "testDistance(): $name", $dist / 1000 ); } public function getDistanceData() { diff --git a/tests/phpunit/GeoSearchTest.php b/tests/phpunit/GeoSearchTest.php index 331e7ef..064d752 100644 --- a/tests/phpunit/GeoSearchTest.php +++ b/tests/phpunit/GeoSearchTest.php @@ -14,7 +14,8 @@ */ class GeoSearchTest extends MediaWikiTestCase { public function setUp() { - $this->setMwGlobals( 'wgAPIListModules', [ 'geosearch' => 'GeoData\Test\MockApiQueryGeoSearch' ] ); + $this->setMwGlobals( 'wgAPIListModules', + [ 'geosearch' => 'GeoData\Test\MockApiQueryGeoSearch' ] ); parent::setUp(); } @@ -31,17 +32,30 @@ */ public function testRequiredParams( array $params ) { $this->setExpectedException( - class_exists( ApiUsageException::class ) ? ApiUsageException::class : UsageException::class + class_exists( ApiUsageException::class ) + ? ApiUsageException::class : UsageException::class ); $this->request( $params ); } public function provideRequiredParams() { return [ - [ [], 'coord, page or bbox are required' ], - [ [ 'gscoord' => '1|2', 'gspage' => 'foo' ], 'Must have only one of coord, page or bbox' ], - // @fixme: [ [ 'gsbbox' => '10|170|-10|-170' ], 'Fail if bounding box is too big' ], - [ [ 'gsbbox' => '10|170|10|170' ], 'Fail if bounding box is too small' ], + [ + [], + 'coord, page or bbox are required' + ], + [ + [ 'gscoord' => '1|2', 'gspage' => 'foo' ], + 'Must have only one of coord, page or bbox' + ], + // @fixme: [ + // [ 'gsbbox' => '10|170|-10|-170' ], + // 'Fail if bounding box is too big' + // ], + [ + [ 'gsbbox' => '10|170|10|170' ], + 'Fail if bounding box is too small' + ], ]; } } diff --git a/tests/phpunit/ParseCoordTest.php b/tests/phpunit/ParseCoordTest.php index 8cec932..6610853 100644 --- a/tests/phpunit/ParseCoordTest.php +++ b/tests/phpunit/ParseCoordTest.php @@ -22,7 +22,9 @@ $this->assertFalse( $s->isGood(), "Parsing of $formatted was expected to fail" ); } else { $msg = $s->isGood() ? '' : $s->getWikiText(); - $this->assertTrue( $s->isGood(), "Parsing of $formatted was expected to succeed, but it failed: $msg" ); + $this->assertTrue( $s->isGood(), + "Parsing of $formatted was expected to succeed, but it failed: $msg" + ); $this->assertTrue( $val->equalsTo( $result ), "Parsing of $formatted was expected to yield something close to" . " ({$result->lat}, {$result->lon}), but yielded ({$val->lat}, {$val->lon})" @@ -43,8 +45,10 @@ [ [ 20, 'N', 30.5, 'W' ], new Coord( 20, -30.5 ) ], [ [ 20, 'S', 30, 'E' ], new Coord( -20, 30 ) ], [ [ 20, 'S', 30, 'W' ], new Coord( -20, -30 ) ], - [ [ 20, 30, 40, 'S', 40, 45, 55, 'E' ], new Coord( -20.511111111111, 40.765277777778 ) ], - [ [ 20, 30, 40, 'N', 40, 45, 55, 'W' ], new Coord( 20.511111111111, -40.765277777778 ) ], + [ [ 20, 30, 40, 'S', 40, 45, 55, 'E' ], + new Coord( -20.511111111111, 40.765277777778 ) ], + [ [ 20, 30, 40, 'N', 40, 45, 55, 'W' ], + new Coord( 20.511111111111, -40.765277777778 ) ], [ [ 20, 'E', 30, 'W' ], false ], [ [ 20, 'S', 30, 'N' ], false ], [ [ -20, 'S', 30, 'E' ], false ], @@ -87,8 +91,10 @@ // coordinate validation and normalisation (non-Earth) [ [ 10, 20 ], new Coord( 10, 20, 'mars' ), 'mars' ], [ [ 110, 20 ], false, 'mars' ], - [ [ 47, 0, 'S', 355, 3, 'W' ], new Coord( -47, 4.95, 'mars' ), 'mars' ], // Asimov Crater - [ [ 68, 'S', 357, 'E' ], new Coord( -68, 357, 'venus' ), 'venus' ], // Quetzalpetlatl Corona + // Asimov Crater + [ [ 47, 0, 'S', 355, 3, 'W' ], new Coord( -47, 4.95, 'mars' ), 'mars' ], + // Quetzalpetlatl Corona + [ [ 68, 'S', 357, 'E' ], new Coord( -68, 357, 'venus' ), 'venus' ], ]; } -} \ No newline at end of file +} diff --git a/tests/phpunit/TagTest.php b/tests/phpunit/TagTest.php index 852e13d..3876e01 100644 --- a/tests/phpunit/TagTest.php +++ b/tests/phpunit/TagTest.php @@ -33,16 +33,19 @@ $this->assertTrue( isset( $out->geoData ) ); if ( !$expected ) { $this->assertEmpty( $out->geoData->getAll(), - 'Expected a failure but a result was found: ' . print_r( $out->geoData->getAll(), true ) + 'Expected a failure but a result was found: ' . + print_r( $out->geoData->getAll(), true ) ); return; } $all = $out->geoData->getAll(); - $this->assertEquals( 1, count( $all ), 'A result was expected, but there was error: ' . strip_tags( $out->getText() ) ); + $this->assertEquals( 1, count( $all ), + 'A result was expected, but there was error: ' . strip_tags( $out->getText() ) ); /** @var Coord $coord */ $coord = $all[0]; $this->assertTrue( $coord->fullyEqualsTo( $expected ), - 'Comparing ' . print_r( $coord, true ) . ' against expected ' . print_r( $expected, true ) + 'Comparing ' . print_r( $coord, true ) . + ' against expected ' . print_r( $expected, true ) ); } -- To view, visit https://gerrit.wikimedia.org/r/356663 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a087a1f40368deaa6110663d541c414d369f95c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GeoData Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits