[MediaWiki-commits] [Gerrit] Cleanup mockups and docs related to localized error parameters - change (mediawiki...Wikibase)
Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/129652 Change subject: Cleanup mockups and docs related to localized error parameters .. Cleanup mockups and docs related to localized error parameters This is a direct follow-up to change I2240d6e0ced47fc2ab1eb5795073c185e6ad336f (bug 64308). Change-Id: I57f6c76bf54ae09dcc9be55aab28b666c9d6b029 --- M lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php M lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php M repo/tests/phpunit/includes/PreSaveChecksTest.php M repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php 4 files changed, 14 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/52/129652/1 diff --git a/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php b/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php index 0b817d6..56af961 100644 --- a/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php +++ b/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php @@ -2,7 +2,6 @@ namespace Wikibase\Test\Validators; -use Status; use ValueFormatters\ValueFormatter; use ValueValidators\Error; use ValueValidators\Result; @@ -32,11 +31,9 @@ function ( $param ) { if ( is_array( $param ) ) { $param = implode( '|', $param ); - } else { - $param = "$param"; } - return $param; + return wfEscapeWikiText( strval( $param ) ); } ) ); @@ -98,4 +95,4 @@ $this->assertEquals( count( $result->getErrors() ), count( $status->getErrorsArray() ), 'Error count:' ); } -} \ No newline at end of file +} diff --git a/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php b/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php index 46d455d..96f616e 100644 --- a/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php +++ b/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php @@ -1,6 +1,7 @@ assertEquals( $expectedParams, $message->getParams(), 'Message parameters:' ); } -} \ No newline at end of file +} diff --git a/repo/tests/phpunit/includes/PreSaveChecksTest.php b/repo/tests/phpunit/includes/PreSaveChecksTest.php index f5e0cbb..8fe5616 100644 --- a/repo/tests/phpunit/includes/PreSaveChecksTest.php +++ b/repo/tests/phpunit/includes/PreSaveChecksTest.php @@ -7,6 +7,7 @@ use ValueValidators\Result; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; +use Wikibase\DataModel\Entity\Item; use Wikibase\PreSaveChecks; use Wikibase\Validators\TermValidatorFactory; use Wikibase\Validators\ValidatorErrorLocalizer; @@ -24,7 +25,6 @@ class PreSaveChecksTest extends \PHPUnit_Framework_TestCase { public function providePreSaveChecks() { - return array( 'empty' => array( 'Wikibase\DataModel\Entity\Item', @@ -160,6 +160,7 @@ /** * @dataProvider providePreSaveChecks * +* @param string $class * @param array $oldData * @param array $newData * @param string[] $expectedErrors @@ -180,8 +181,9 @@ $errorLocalizer ); - /* @var Entity $oldEntity */ - /* @var Entity $newEntity */ + /** @var Item $class */ + /** @var Entity $oldEntity */ + /** @var Entity $newEntity */ $oldEntity = $oldData == null ? null : $class::newFromArray( $oldData ); $newEntity = $class::newFromArray( $newData ); $diff = $oldEntity == null ? null : $oldEntity->getDiff( $newEntity ); diff --git a/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php b/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php index e6a100c..00f9835 100644 --- a/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php +++ b/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php @@ -2,13 +2,13 @@ namespace Wikibase\Test\Api; +use ApiMain; use DataValues\StringValue; use UsageException; use ValueFormatters\ValueFormatter; -use Wikibase\Api\CreateClaim; -use ApiMain; -use Wikibase\Api\ClaimModificationHelper; use Wikibase\Api\ApiErrorReporter; +use Wikibase\Api\ClaimModificationHelper; +use Wikibase\Api\CreateClaim; use Wikibase\DataModel\Claim\Claims; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Snak\PropertyValueSnak; @@ -93,11 +93,9 @@ function ( $param ) {
[MediaWiki-commits] [Gerrit] Cleanup mockups and docs related to localized error parameters - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Cleanup mockups and docs related to localized error parameters .. Cleanup mockups and docs related to localized error parameters This is a direct follow-up to change I2240d6e0ced47fc2ab1eb5795073c185e6ad336f (bug 64308). Change-Id: I57f6c76bf54ae09dcc9be55aab28b666c9d6b029 --- M lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php M lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php M repo/tests/phpunit/includes/PreSaveChecksTest.php M repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php 4 files changed, 15 insertions(+), 19 deletions(-) Approvals: WikidataJenkins: Verified Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php b/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php index 0b817d6..d8a567a 100644 --- a/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php +++ b/lib/tests/phpunit/Validators/ValidatorErrorLocalizerTest.php @@ -2,7 +2,6 @@ namespace Wikibase\Test\Validators; -use Status; use ValueFormatters\ValueFormatter; use ValueValidators\Error; use ValueValidators\Result; @@ -32,11 +31,9 @@ function ( $param ) { if ( is_array( $param ) ) { $param = implode( '|', $param ); - } else { - $param = "$param"; } - return $param; + return strval( $param ); } ) ); @@ -98,4 +95,4 @@ $this->assertEquals( count( $result->getErrors() ), count( $status->getErrorsArray() ), 'Error count:' ); } -} \ No newline at end of file +} diff --git a/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php b/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php index 46d455d..16e8b4e 100644 --- a/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php +++ b/lib/tests/phpunit/i18n/WikibaseExceptionLocalizerTest.php @@ -1,6 +1,7 @@ assertEquals( $expectedParams, $message->getParams(), 'Message parameters:' ); } -} \ No newline at end of file +} diff --git a/repo/tests/phpunit/includes/PreSaveChecksTest.php b/repo/tests/phpunit/includes/PreSaveChecksTest.php index f5e0cbb..637d6e3 100644 --- a/repo/tests/phpunit/includes/PreSaveChecksTest.php +++ b/repo/tests/phpunit/includes/PreSaveChecksTest.php @@ -7,6 +7,7 @@ use ValueValidators\Result; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; +use Wikibase\DataModel\Entity\Item; use Wikibase\PreSaveChecks; use Wikibase\Validators\TermValidatorFactory; use Wikibase\Validators\ValidatorErrorLocalizer; @@ -24,7 +25,6 @@ class PreSaveChecksTest extends \PHPUnit_Framework_TestCase { public function providePreSaveChecks() { - return array( 'empty' => array( 'Wikibase\DataModel\Entity\Item', @@ -150,7 +150,7 @@ $param = get_class( $param ); } - return wfEscapeWikiText( strval( $param ) ); + return strval( $param ); } ) ); @@ -160,6 +160,7 @@ /** * @dataProvider providePreSaveChecks * +* @param string $class * @param array $oldData * @param array $newData * @param string[] $expectedErrors @@ -180,8 +181,9 @@ $errorLocalizer ); - /* @var Entity $oldEntity */ - /* @var Entity $newEntity */ + /** @var Item $class */ + /** @var Entity $oldEntity */ + /** @var Entity $newEntity */ $oldEntity = $oldData == null ? null : $class::newFromArray( $oldData ); $newEntity = $class::newFromArray( $newData ); $diff = $oldEntity == null ? null : $oldEntity->getDiff( $newEntity ); diff --git a/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php b/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php index e6a100c..6baf178 100644 --- a/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php +++ b/repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php @@ -2,13 +2,13 @@ namespace Wikibase\Test\Api; +use ApiMain; use DataValues\StringValue; use UsageException; use ValueFormatters\ValueFormatter; -use Wikibase\Api\CreateClaim; -use ApiMain; -use Wikibase\Api\ClaimModificationHelper; u