[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add tests for two uncovered CheckResult methods
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406059 ) Change subject: Add tests for two uncovered CheckResult methods .. Add tests for two uncovered CheckResult methods Change-Id: I6a38d5068b0149d6e98eaf370855cc13b905 --- M tests/phpunit/Result/CheckResultTest.php 1 file changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/59/406059/1 diff --git a/tests/phpunit/Result/CheckResultTest.php b/tests/phpunit/Result/CheckResultTest.php index 0c4d8fa..9566952 100644 --- a/tests/phpunit/Result/CheckResultTest.php +++ b/tests/phpunit/Result/CheckResultTest.php @@ -65,4 +65,26 @@ $checkResult->getDataValue(); } + public function testAddParameter() { + $context = new FakeSnakContext( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) ); + $constraint = new Constraint( '', new PropertyId( 'P1' ), 'Q1', [] ); + $checkResult = new CheckResult( $context, $constraint ); + + $this->assertSame( [], $checkResult->getParameters() ); + + $checkResult->addParameter( 'constraint_status', 'mandatory' ); + $this->assertSame( [ 'constraint_status' => [ 'mandatory' ] ], $checkResult->getParameters() ); + } + + public function testSetStatus() { + $context = new FakeSnakContext( new PropertyNoValueSnak( new PropertyId( 'P1' ) ) ); + $constraint = new Constraint( '', new PropertyId( 'P1' ), 'Q1', [] ); + $checkResult = new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION ); + + $this->assertSame( CheckResult::STATUS_VIOLATION, $checkResult->getStatus() ); + + $checkResult->setStatus( CheckResult::STATUS_WARNING ); + $this->assertSame( CheckResult::STATUS_WARNING, $checkResult->getStatus() ); + } + } -- To view, visit https://gerrit.wikimedia.org/r/406059 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6a38d5068b0149d6e98eaf370855cc13b905 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ArticlePlaceholder[master]: Type hint against IDatabase instead of Database
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406056 ) Change subject: Type hint against IDatabase instead of Database .. Type hint against IDatabase instead of Database The interface is smaller, and all that's needed here. This patch also removes an obsolete documentation that is 100% identical to the method header. Change-Id: Ia666dec4dfea7089183d4adb5c42bf6ffbf0b4f6 --- M includes/BaseTemplateToolboxHookHandler.php M includes/ItemNotabilityFilter.php 2 files changed, 3 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticlePlaceholder refs/changes/56/406056/1 diff --git a/includes/BaseTemplateToolboxHookHandler.php b/includes/BaseTemplateToolboxHookHandler.php index 986ff2c..afbc19d 100644 --- a/includes/BaseTemplateToolboxHookHandler.php +++ b/includes/BaseTemplateToolboxHookHandler.php @@ -49,11 +49,6 @@ ); } - /** -* @param EntityIdParser $entityIdParser -* @param RepoLinker $repoLinker -* @param EntityLookup $entityLookup -*/ public function __construct( EntityIdParser $entityIdParser, RepoLinker $repoLinker, diff --git a/includes/ItemNotabilityFilter.php b/includes/ItemNotabilityFilter.php index 3974a62..d41d2d3 100644 --- a/includes/ItemNotabilityFilter.php +++ b/includes/ItemNotabilityFilter.php @@ -5,7 +5,7 @@ use Wikibase\DataModel\Entity\ItemId; use Wikibase\Lib\Store\EntityNamespaceLookup; use Wikibase\Lib\Store\SiteLinkLookup; -use Wikimedia\Rdbms\Database; +use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\ResultWrapper; use Wikimedia\Rdbms\SessionConsistentConnectionManager; @@ -120,12 +120,12 @@ } /** -* @param Database $dbr +* @param IDatabase $dbr * @param ItemId[] $itemIds * * @return ResultWrapper */ - private function selectPagePropsPage( Database $dbr, array $itemIds ) { + private function selectPagePropsPage( IDatabase $dbr, array $itemIds ) { $entityNamespace = $this->entityNamespaceLookup->getEntityNamespace( 'item' ); if ( !is_int( $entityNamespace ) ) { -- To view, visit https://gerrit.wikimedia.org/r/406056 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia666dec4dfea7089183d4adb5c42bf6ffbf0b4f6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ArticlePlaceholder Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ArticlePlaceholder[master]: Add more test cases to improve overall test coverage
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406054 ) Change subject: Add more test cases to improve overall test coverage .. Add more test cases to improve overall test coverage Change-Id: I28547aa378977d1c379e7e709357d9916c511e1f --- M tests/phpunit/includes/HooksTest.php A tests/phpunit/includes/Lua/Scribunto_LuaArticlePlaceholderLibraryTest.php 2 files changed, 99 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ArticlePlaceholder refs/changes/54/406054/1 diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 1e9a960..e5c9e5a 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -15,6 +15,15 @@ */ class HooksTest extends PHPUnit_Framework_TestCase { + public function testOnScribuntoExternalLibraries() { + $instance = new Hooks(); + $extraLibraries = []; + $instance->onScribuntoExternalLibraries( 'lua', $extraLibraries ); + $this->assertCount( 1, $extraLibraries ); + $this->assertContainsOnly( 'array', $extraLibraries ); + $this->assertArrayHasKey( 'class', reset( $extraLibraries ) ); + } + public function testRegisterScribuntoExternalLibraryPaths() { $instance = new Hooks(); $paths = []; diff --git a/tests/phpunit/includes/Lua/Scribunto_LuaArticlePlaceholderLibraryTest.php b/tests/phpunit/includes/Lua/Scribunto_LuaArticlePlaceholderLibraryTest.php new file mode 100644 index 000..ffaec0f --- /dev/null +++ b/tests/phpunit/includes/Lua/Scribunto_LuaArticlePlaceholderLibraryTest.php @@ -0,0 +1,90 @@ +setMwGlobals( [ + 'wgArticlePlaceholderImageProperty' => 'P2001', + 'wgArticlePlaceholderReferencesBlacklist' => 'P2002', + ] ); + } + + public function testGetImageProperty() { + $instance = $this->newInstance(); + + $actual = $instance->getImageProperty(); + $this->assertSame( [ 'P2001' ], $actual ); + } + + public function testGetImageProperty_throwsException() { + $this->setMwGlobals( 'wgArticlePlaceholderImageProperty', '' ); + $instance = $this->newInstance(); + + $this->setExpectedException( RuntimeException::class ); + $instance->getImageProperty(); + } + + public function testGetReferencesBlacklist() { + $instance = $this->newInstance(); + + $actual = $instance->getReferencesBlacklist(); + $this->assertSame( [ 'P2002' ], $actual ); + } + + public function testGetReferencesBlacklist_returnsNull() { + $this->setMwGlobals( 'wgArticlePlaceholderReferencesBlacklist', '' ); + $instance = $this->newInstance(); + + $actual = $instance->getReferencesBlacklist(); + $this->assertNull( $actual ); + } + + public function testRegister() { + $engine = $this->getMockBuilder( Scribunto_LuaEngine::class ) + ->disableOriginalConstructor() + ->getMock(); + $engine->expects( $this->once() ) + ->method( 'registerInterface' ) + ->willReturnCallback( function ( + $moduleFileName, + array $interfaceFuncs, + array $setupOptions + ) { + $this->assertFileExists( $moduleFileName ); + $this->assertInternalType( 'callable', $interfaceFuncs['getImageProperty'] ); + $this->assertInternalType( 'callable', $interfaceFuncs['getReferencesBlacklist'] ); + + return 'dummyReturnValue'; + } ); + $instance = new Scribunto_LuaArticlePlaceholderLibrary( $engine ); + + $actual = $instance->register(); + $this->assertSame( 'dummyReturnValue', $actual ); + } + + private function newInstance() { + $engine = $this->getMockBuilder( Scribunto_LuaEngine::class ) + ->disableOriginalConstructor() + ->getMock(); + + return new Scribunto_LuaArticlePlaceholderLibrary( $engine ); + } + +} -- To view, visit https://gerrit.
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Split up and test CheckConstraints::newFromGlobalState
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406050 ) Change subject: Split up and test CheckConstraints::newFromGlobalState .. Split up and test CheckConstraints::newFromGlobalState CheckConstraints::newFromGlobalState was one giant method that initialized the dependency injection for everything else. This commit splits it up into several methods and adds tests for all of them. I’ll be the first to admit that this still isn’t great, and that the tests don’t do very much, but at least we’ll now get test failures if one of the classes instantiated here gains a parameter, which previously would only be detected by manual tests. Bug: T183373 Change-Id: Ie075eade0f9155128898564874bea9f38a86f443 --- M src/Api/CheckConstraints.php M tests/phpunit/Api/CheckConstraintsTest.php 2 files changed, 221 insertions(+), 72 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/50/406050/1 diff --git a/src/Api/CheckConstraints.php b/src/Api/CheckConstraints.php index 46b5303..6d092ba 100644 --- a/src/Api/CheckConstraints.php +++ b/src/Api/CheckConstraints.php @@ -4,9 +4,11 @@ use ApiBase; use ApiMain; +use Config; use IBufferingStatsdDataFactory; use MediaWiki\MediaWikiServices; use RequestContext; +use TitleParser; use ValueFormatters\FormatterOptions; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParser; @@ -19,6 +21,7 @@ use Wikibase\Repo\Api\ResultBuilder; use Wikibase\Repo\EntityIdLabelFormatterFactory; use Wikibase\Repo\WikibaseRepo; +use WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker; use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\ConstraintParameterParser; use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResult; use WikibaseQuality\ConstraintReport\ConstraintParameterRenderer; @@ -75,32 +78,91 @@ * @param string $prefix * * @return self +* +* @codeCoverageIgnore hard to test and only delegates to other methods */ public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { - $repo = WikibaseRepo::getDefaultInstance(); + return self::getCheckConstraints( + MediaWikiServices::getInstance(), + WikibaseRepo::getDefaultInstance(), + $main, + $name, + $prefix + ); + } + public static function getCheckConstraints( + MediaWikiServices $services, + WikibaseRepo $repo, + ApiMain $main, + $name, + $prefix + ) { + $config = $services->getMainConfig(); + $dataFactory = $services->getStatsdDataFactory(); + $titleParser = $services->getTitleParser(); + + $constraintParameterRenderer = self::getConstraintParameterRenderer( + $config, + $repo + ); + $constraintReportFactory = self::getConstraintReportFactory( + $config, + $dataFactory, + $titleParser, + $repo, + $constraintParameterRenderer + ); + $resultsBuilder = self::getResultsBuilder( + $config, + $dataFactory, + $repo, + $constraintParameterRenderer, + $constraintReportFactory->getConstraintChecker() + ); + + return new CheckConstraints( + $main, + $name, + $prefix, + $repo->getEntityIdParser(), + $repo->getStatementGuidValidator(), + $repo->getApiHelperFactory( RequestContext::getMain() ), + $resultsBuilder, + $dataFactory + ); + } + + public static function getConstraintParameterRenderer( + Config $config, + WikibaseRepo $repo + ) { $language = $repo->getUserLanguage(); - $formatterOptions = new FormatterOptions(); - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); - $valueFormatterFactory = $repo->getValueFormatterFactory(); - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); - - $languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupF
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Change namespace from …\Test to …\Tests
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406043 ) Change subject: Change namespace from …\Test to …\Tests .. Change namespace from …\Test to …\Tests Both \WikibaseQuality\ConstraintReport\Test and \WikibaseQuality\ConstraintReport\Tests were in use; the plural form seems to be the standard in Wikibase, so let’s settle on that. Change-Id: I721ea0db2164f2e1db706f7f7c6bc690e029c516 --- M tests/phpunit/Cache/CachedArrayTest.php M tests/phpunit/Cache/CachedBoolTest.php M tests/phpunit/Cache/CachedCheckConstraintsResponseTest.php M tests/phpunit/Cache/CachedEntityIdsTest.php M tests/phpunit/Cache/CachedQueryResultsTest.php M tests/phpunit/Cache/CachingMetadataTest.php M tests/phpunit/Cache/DependencyMetadataTest.php M tests/phpunit/Cache/MetadataTest.php M tests/phpunit/Checker/CommonsLinkChecker/CommonsLinkCheckerTest.php M tests/phpunit/Checker/ConnectionChecker/ConflictsWithCheckerTest.php M tests/phpunit/Checker/ConnectionChecker/ConnectionCheckerHelperTest.php M tests/phpunit/Checker/ConnectionChecker/InverseCheckerTest.php M tests/phpunit/Checker/ConnectionChecker/ItemCheckerTest.php M tests/phpunit/Checker/ConnectionChecker/SymmetricCheckerTest.php M tests/phpunit/Checker/ConnectionChecker/TargetRequiredClaimCheckerTest.php M tests/phpunit/Checker/FormatChecker/FormatCheckerTest.php M tests/phpunit/Checker/OneOfChecker/OneOfCheckerTest.php M tests/phpunit/Checker/QualifierChecker/MandatoryQualifiersCheckerTest.php M tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php M tests/phpunit/Checker/QualifierChecker/QualifiersCheckerTest.php M tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php M tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php M tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php M tests/phpunit/Checker/ReferenceCheckerTest.php M tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php M tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php M tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/UniqueValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php M tests/phpunit/Checker/ValueOnlyCheckerTest.php M tests/phpunit/ConstraintReportFactoryTest.php M tests/phpunit/Context/MainSnakContextTest.php M tests/phpunit/Context/QualifierContextTest.php M tests/phpunit/Context/ReferenceContextTest.php M tests/phpunit/DelegatingConstraintCheckerTest.php M tests/phpunit/Helper/ConstraintParameterParserTest.php M tests/phpunit/Helper/LoggingHelperTest.php M tests/phpunit/Helper/SparqlHelperTest.php M tests/phpunit/Result/CheckResultTest.php 41 files changed, 41 insertions(+), 41 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/43/406043/1 diff --git a/tests/phpunit/Cache/CachedArrayTest.php b/tests/phpunit/Cache/CachedArrayTest.php index d635bf8..0469b49 100644 --- a/tests/phpunit/Cache/CachedArrayTest.php +++ b/tests/phpunit/Cache/CachedArrayTest.php @@ -1,6 +1,6 @@ https://gerrit.wikimedia.org/r/406043 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I721ea0db2164f2e1db706f7f7c6bc690e029c516 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add tests for ItemIdSnakValue
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406041 ) Change subject: Add tests for ItemIdSnakValue .. Add tests for ItemIdSnakValue Change-Id: Ic3e84dfe44983a80499049472e3b62047223f7c9 --- M src/ConstraintCheck/ItemIdSnakValue.php A tests/phpunit/ItemIdSnakValueTest.php 2 files changed, 166 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/41/406041/1 diff --git a/src/ConstraintCheck/ItemIdSnakValue.php b/src/ConstraintCheck/ItemIdSnakValue.php index 977dbb1..706e27f 100644 --- a/src/ConstraintCheck/ItemIdSnakValue.php +++ b/src/ConstraintCheck/ItemIdSnakValue.php @@ -130,6 +130,7 @@ * Get the item ID contained in this {@link ItemIdSnakValue}. * Only valid if {@link isValue} is true. * +* @throws DomainException if this value does not contain an item ID * @return ItemId */ public function getItemId() { diff --git a/tests/phpunit/ItemIdSnakValueTest.php b/tests/phpunit/ItemIdSnakValueTest.php new file mode 100644 index 000..fda55a1 --- /dev/null +++ b/tests/phpunit/ItemIdSnakValueTest.php @@ -0,0 +1,165 @@ +assertTrue( $value->isValue() ); + $this->assertFalse( $value->isSomeValue() ); + $this->assertFalse( $value->isNoValue() ); + $this->assertSame( $itemId, $value->getItemId() ); + } + + public function testSomeValue() { + $value = ItemIdSnakValue::someValue(); + + $this->assertFalse( $value->isValue() ); + $this->assertTrue( $value->isSomeValue() ); + $this->assertFalse( $value->isNoValue() ); + + $this->setExpectedException( DomainException::class ); + $value->getItemId(); + } + + public function testNoValue() { + $value = ItemIdSnakValue::noValue(); + + $this->assertFalse( $value->isValue() ); + $this->assertFalse( $value->isSomeValue() ); + $this->assertTrue( $value->isNoValue() ); + + $this->setExpectedException( DomainException::class ); + $value->getItemId(); + } + + public function testFromSnak_ItemId() { + $itemId = new ItemId( 'Q1' ); + $snak = new PropertyValueSnak( + new PropertyId( 'P100' ), + new EntityIdValue( $itemId ) + ); + + $value = ItemIdSnakValue::fromSnak( $snak ); + + $this->assertTrue( $value->isValue() ); + $this->assertSame( $itemId, $value->getItemId() ); + } + + public function testFromSnak_PropertyId() { + $propertyId = new PropertyId( 'P1' ); + $snak = new PropertyValueSnak( + new PropertyId( 'P100' ), + new EntityIdValue( $propertyId ) + ); + + $this->setExpectedException( InvalidArgumentException::class ); + $value = ItemIdSnakValue::fromSnak( $snak ); + } + + public function testFromSnak_String() { + $snak = new PropertyValueSnak( + new PropertyId( 'P100' ), + new StringValue( 'Q1' ) + ); + + $this->setExpectedException( InvalidArgumentException::class ); + $value = ItemIdSnakValue::fromSnak( $snak ); + } + + public function testFromSnak_SomeValue() { + $snak = new PropertySomeValueSnak( new PropertyId( 'P100' ) ); + + $value = ItemIdSnakValue::fromSnak( $snak ); + + $this->assertTrue( $value->isSomeValue() ); + } + + public function testFromSnak_NoValue() { + $snak = new PropertyNoValueSnak( new PropertyId( 'P100' ) ); + + $value = ItemIdSnakValue::fromSnak( $snak ); + + $this->assertTrue( $value->isNoValue() ); + } + + public function testMatchesSnak_ItemId() { + $itemId = new ItemId( 'Q1' ); + $snak = new PropertyValueSnak( + new PropertyId( 'P100' ), + new EntityIdValue( $itemId ) + ); + + $this->assertTrue( ItemIdSnakValue::fromItemId( $itemId )->matchesSnak( $snak ) ); + $this->assertFalse( ItemIdSnakValue::someValue()->matchesSnak( $snak ) ); + $this->assertFalse( ItemIdSnakValue::noValue()->matchesSnak( $snak ) ); + } + + public function testMatchesSnak_PropertyId() { + $itemId = new Item
[MediaWiki-commits] [Gerrit] mediawiki...TwoColConflict[master]: [WIP] Update msg text and add i18n
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406040 ) Change subject: [WIP] Update msg text and add i18n .. [WIP] Update msg text and add i18n Bug: T183362 Change-Id: I3f9ee8496db0fdce04a3ca90cd1cd7bc6a162cd3 --- M extension.json M i18n/en.json M i18n/qqq.json M includes/GoatTwoColConflict/HtmlGoatConflictHeader.php M includes/GoatTwoColConflict/HtmlGoatConflictView.php M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js 6 files changed, 51 insertions(+), 26 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoColConflict refs/changes/40/406040/1 diff --git a/extension.json b/extension.json index b9bbc06..dfbc5af 100644 --- a/extension.json +++ b/extension.json @@ -205,6 +205,12 @@ "oojs-ui", "oojs-ui.styles.icons-editing-core", "oojs-ui.styles.icons-interactions" + ], + "messages": [ + "twoColConflict-goat-your-version", + "twoColConflict-goat-other-version", + "twoColConflict-goat-show-unselected", + "twoColConflict-goat-show-error-hint" ] }, "ext.TwoColConflict.GoatCss": { diff --git a/i18n/en.json b/i18n/en.json index bd7835f..c026119 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -57,5 +57,18 @@ "twoColConflict-test-preview-hint": "Thanks for trying out the Two Column Edit Conflict interface! Help us make improvements by providing us with your feedback [//meta.wikimedia.org/wiki/Talk:WMDE_Technical_Wishes/Edit_Conflicts/Feedback_Round_Test_Page here].\n\nBelow are the results of your test edit conflict resolution.", "twoColConflict-test-username": "ConflictTest User", "twoColConflict-test-summary-text": "Conflict test edit summary", - "twoColConflict-goat-saved-at": "saved $1, $2." + "twoColConflict-goat-edit-button": "Edit text", + "twoColConflict-goat-reset-button": "Reset text", + "twoColConflict-goat-save-button": "Save changes and leave editing mode", + "twoColConflict-goat-abort-button": "Abort editing and discard changes", + "twoColConflict-goat-collapse-button": "Collapse text", + "twoColConflict-goat-expand-button": "Expand text", + "twoColConflict-goat-choose-version": "Please choose a version", + "twoColConflict-goat-your-version": "Your version", + "twoColConflict-goat-other-version": "Other version", + "twoColConflict-goat-show-error-hint": "There are paragraphs you didn't choose a version for. Please select one for each paragraph.", + "twoColConflict-goat-show-unselected": "Show me unselected paragraphs -->", + "twoColConflict-goat-saved-at": "saved $1, $2.", + "twoColConflict-goat-other-header": "Conflicting version from", + "twoColConflict-goat-other-header2": "which is live now." } diff --git a/i18n/qqq.json b/i18n/qqq.json index 9039533..f64f1b6 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -62,5 +62,18 @@ "twoColConflict-test-preview-hint": "Last hint shown on the conflict test page above the preview of the resolved test conflict.", "twoColConflict-test-username": "Username for the conflict test page's fictitious conflicting edit.", "twoColConflict-test-summary-text": "Edit summary for the conflict test page's fictitious conflicting edit.", - "twoColConflict-goat-saved-at": "Header for the diff columns showing the time and date when the content was modified.\n\nParameters:\n* $1 - date\n* $2 - time" + "twoColConflict-goat-edit-button": "Label for the edit button shown on diff paragraphs.", + "twoColConflict-goat-reset-button": "Label for the reset button shown on diff paragraphs.", + "twoColConflict-goat-save-button": "Label for the save button shown on diff paragraphs to save changes in that paragraph.", + "twoColConflict-goat-abort-button": "Label for the abort button to discard changes in an edited diff paragraph.", + "twoColConflict-goat-collapse-button": "Label for the collapse button to collapse
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Fix type hint for PoolWorkArticleView::getParserOutput
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406038 ) Change subject: Fix type hint for PoolWorkArticleView::getParserOutput .. Fix type hint for PoolWorkArticleView::getParserOutput Change-Id: Ib6a71e198481cf2a0230b3f8721c019ef3c7288c --- M includes/poolcounter/PoolWorkArticleView.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/38/406038/1 diff --git a/includes/poolcounter/PoolWorkArticleView.php b/includes/poolcounter/PoolWorkArticleView.php index 17b62d7..7b888ab 100644 --- a/includes/poolcounter/PoolWorkArticleView.php +++ b/includes/poolcounter/PoolWorkArticleView.php @@ -79,7 +79,7 @@ /** * Get the ParserOutput from this object, or false in case of failure * -* @return ParserOutput +* @return ParserOutput|bool */ public function getParserOutput() { return $this->parserOutput; -- To view, visit https://gerrit.wikimedia.org/r/406038 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib6a71e198481cf2a0230b3f8721c019ef3c7288c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add tests for maintenance script
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406037 ) Change subject: Add tests for maintenance script .. Add tests for maintenance script Change-Id: I66b8b4642827134fc9e63e2bb0c3eba54135b3ad Depends-On: I61970403f9c371d3798f34fd48c70bc72f0c7eda --- A tests/phpunit/Maintenance/ImportConstraintStatementsTest.php 1 file changed, 89 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/37/406037/1 diff --git a/tests/phpunit/Maintenance/ImportConstraintStatementsTest.php b/tests/phpunit/Maintenance/ImportConstraintStatementsTest.php new file mode 100644 index 000..e0936fd --- /dev/null +++ b/tests/phpunit/Maintenance/ImportConstraintStatementsTest.php @@ -0,0 +1,89 @@ +maintenance->setConfig( new HashConfig( [ + 'WBQualityConstraintsEnableConstraintsImportFromStatements' => false, + ] ) ); + + $this->maintenance->execute(); + + $this->expectOutputString( 'Constraint statements are not enabled. Aborting.' ); + } + + public function testNoProperties() { + $this->maintenance->propertyInfoLookup = new MockPropertyInfoLookup( [] ); + $this->maintenance->newUpdateConstraintsTableJob = function () { + $this->fail( 'newUpdateConstraintsTableJob should not be called' ); + }; + + $this->maintenance->execute(); + + $this->expectOutputString( '' ); + } + + public function testTwoProperties() { + $this->maintenance->propertyInfoLookup = new MockPropertyInfoLookup( [ + 'P1' => [], + 'P3' => [], + ] ); + $call = 0; + $this->maintenance->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) use ( &$call ) { + $mock = $this->getMockBuilder( UpdateConstraintsTableJob::class ) + ->disableOriginalConstructor() + ->setMethods( [ 'run' ] ) + ->getMock(); + $mock->expects( $this->once() ) + ->method( 'run' ) + ->with(); + switch ( ++$call ) { + case 1: + $this->assertSame( 'P1', $propertyIdSerialization ); + return $mock; + case 2: + $this->assertSame( 'P3', $propertyIdSerialization ); + return $mock; + default: + $this->fail( 'newUpdateConstraintsTableJob should only be called twice' ); + return $mock; // unreachable but just in case + } + }; + + $this->maintenance->execute(); + + $this->expectOutputRegex( '/^' . + 'Importing constraint statements for +P1... done in +\d+\.\d+ ms.\n' . + 'Importing constraint statements for +P3... done in +\d+\.\d+ ms.\n' . + '$/' ); + $this->assertSame( 2, $call, 'newUpdateConstraintsTableJob should have been called twice' ); + } + + public function testDefaultNewUpdateConstraintsTableJob() { + $job = call_user_func( $this->maintenance->newUpdateConstraintsTableJob, 'P1234' ); + + $this->assertInstanceOf( UpdateConstraintsTableJob::class, $job ); + $params = $job->getParams(); + $this->assertArrayHasKey( 'propertyId', $params ); + $this->assertSame( 'P1234', $params['propertyId'] ); + } + +} -- To view, visit https://gerrit.wikimedia.org/r/406037 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66b8b4642827134fc9e63e2bb0c3eba54135b3ad Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Make maintenance script testable
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406036 ) Change subject: Make maintenance script testable .. Make maintenance script testable Use Maintenance::getConfig(), which has a corresponding setter which tests can use, instead of getting the config from the services directly. Move code to get the PropertyInfoLookup, and to instantiate the UpdateConstraintsTableJob, into the constructor, where it is stored in private member variables which tests can then later override (using TestingAccessWrapper to get around the access restrictions). And to make sure we can actually find the class in the tests, register its containing directory in the autoload namespaces. Also removes the use of Maintenance::error()’s deprecated $die parameter. There is a fatalError() function we could use instead, but in that case we could completely terminate the tests, which isn’t what we want. Instead, simply return from execute(). Change-Id: I57f5a102f542db0b59347ec82fe85277ffb95560 --- M extension.json M maintenance/ImportConstraintStatements.php 2 files changed, 28 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/36/406036/1 diff --git a/extension.json b/extension.json index bc3d7c8..e60e04d 100644 --- a/extension.json +++ b/extension.json @@ -422,6 +422,7 @@ }, "AutoloadNamespaces": { "WikibaseQuality\\ConstraintReport\\": "src/", + "WikibaseQuality\\ConstraintReport\\Maintenance\\": "maintenance/", "WikibaseQuality\\ConstraintReport\\Tests\\": "tests/phpunit/" }, "manifest_version": 2 diff --git a/maintenance/ImportConstraintStatements.php b/maintenance/ImportConstraintStatements.php index 2a17564..f0d640c 100644 --- a/maintenance/ImportConstraintStatements.php +++ b/maintenance/ImportConstraintStatements.php @@ -4,14 +4,16 @@ use Maintenance; use Title; -use MediaWiki\MediaWikiServices; +use Wikibase\Lib\Store\PropertyInfoLookup; use WikibaseQuality\ConstraintReport\UpdateConstraintsTableJob; use Wikibase\Repo\WikibaseRepo; +// @codeCoverageIgnoreStart $basePath = getenv( "MW_INSTALL_PATH" ) !== false ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; require_once $basePath . "/maintenance/Maintenance.php"; +// @codeCoverageIgnoreEnd /** * Runs {@link UpdateConstraintsTableJob} once for every property. @@ -20,22 +22,41 @@ */ class ImportConstraintStatements extends Maintenance { + /** +* @var PropertyInfoLookup +*/ + private $propertyInfoLookup; + + /** +* @var callable +* @return UpdateConstraintsTableJob +*/ + private $newUpdateConstraintsTableJob; + public function __construct() { parent::__construct(); + $repo = WikibaseRepo::getDefaultInstance(); + $this->propertyInfoLookup = $repo->getStore()->getPropertyInfoLookup(); + $this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) { + return UpdateConstraintsTableJob::newFromGlobalState( + Title::newMainPage(), + [ 'propertyId' => $propertyIdSerialization ] + ); + }; $this->addDescription( 'Imports property constraints from statements on properties' ); } public function execute() { - if ( !MediaWikiServices::getInstance()->getMainConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { - $this->error( 'Constraint statements are not enabled. Aborting.', 1 ); + if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { + $this->error( 'Constraint statements are not enabled. Aborting.' ); + return; } - $propertyInfoLookup = WikibaseRepo::getDefaultInstance()->getStore()->getPropertyInfoLookup(); - foreach ( $propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) { + foreach ( $this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) { $this->output( sprintf( 'Importing constraint statements for % 6s... ', $propertyIdSerialization ), $propertyIdSerialization ); $startTime = microtime( true ); - $job = UpdateConstraintsTableJob::newFromGlobalState( Title::newMain
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Don’t write to stderr when testing
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406035 ) Change subject: Don’t write to stderr when testing .. Don’t write to stderr when testing This change makes it possible to test error() messages with expectOutputString() or expectOutputRegex(). Change-Id: I61970403f9c371d3798f34fd48c70bc72f0c7eda --- M maintenance/Maintenance.php 1 file changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/35/406035/1 diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 5adbee5..69284ac 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -414,7 +414,10 @@ $this->fatalError( $err, intval( $die ) ); } $this->outputChanneled( false ); - if ( PHP_SAPI == 'cli' || PHP_SAPI == 'phpdbg' ) { + if ( + ( PHP_SAPI == 'cli' || PHP_SAPI == 'phpdbg' ) && + !defined( 'MW_PHPUNIT_TEST' ) + ) { fwrite( STDERR, $err . "\n" ); } else { print $err; -- To view, visit https://gerrit.wikimedia.org/r/406035 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I61970403f9c371d3798f34fd48c70bc72f0c7eda Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Add missing Maintenance import
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406034 ) Change subject: Add missing Maintenance import .. Add missing Maintenance import Without this import, the @var Maintenance comment on $maintenance doesn’t refer to the right class. Change-Id: I2b5efa422f3e9d50f2132658b04ea2814af61954 --- M tests/phpunit/maintenance/MaintenanceBaseTestCase.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/34/406034/1 diff --git a/tests/phpunit/maintenance/MaintenanceBaseTestCase.php b/tests/phpunit/maintenance/MaintenanceBaseTestCase.php index 9d73a51..bdcf7e5 100644 --- a/tests/phpunit/maintenance/MaintenanceBaseTestCase.php +++ b/tests/phpunit/maintenance/MaintenanceBaseTestCase.php @@ -2,6 +2,7 @@ namespace MediaWiki\Tests\Maintenance; +use Maintenance; use MediaWikiTestCase; use Wikimedia\TestingAccessWrapper; -- To view, visit https://gerrit.wikimedia.org/r/406034 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b5efa422f3e9d50f2132658b04ea2814af61954 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Remove meaningless comments repeating the class name twice
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406033 ) Change subject: Remove meaningless comments repeating the class name twice .. Remove meaningless comments repeating the class name twice Remove all comments stating the "File holding the … class" as well as "The … class." These comments do nothing but repeating the class name. The generated documentation will state that a file named (for example) Foo.php "holds the Foo class". In an other place the documentation will state that the class "Foo" is "the Foo class". Such comments are worse than having no comments, because I need to read them to understand they do not hold any additional information, and do not explain anything. Removing these comments makes room for actual improvements in the future. Note there are actual mistakes in some of these comments, e.g. because the class got renamed, but the comment not updated. Change-Id: I54ad9ac68684f558228f1b646f97da2c14674ca8 --- M includes/PF_AutoeditAPI.php M includes/forminputs/PF_CheckboxInput.php M includes/forminputs/PF_CheckboxesInput.php M includes/forminputs/PF_ComboBoxInput.php M includes/forminputs/PF_DateInput.php M includes/forminputs/PF_DatePickerInput.php M includes/forminputs/PF_DateTimeInput.php M includes/forminputs/PF_DateTimePicker.php M includes/forminputs/PF_DropdownInput.php M includes/forminputs/PF_EnumInput.php M includes/forminputs/PF_FormInput.php M includes/forminputs/PF_GoogleMapsInput.php M includes/forminputs/PF_LeafletInput.php M includes/forminputs/PF_ListBoxInput.php M includes/forminputs/PF_MultiEnumInput.php M includes/forminputs/PF_OpenLayersInput.php M includes/forminputs/PF_RadioButtonInput.php M includes/forminputs/PF_RatingInput.php M includes/forminputs/PF_RegExpInput.php M includes/forminputs/PF_TextAreaInput.php M includes/forminputs/PF_TextAreaWithAutocompleteInput.php M includes/forminputs/PF_TextInput.php M includes/forminputs/PF_TextWithAutocompleteInput.php M includes/forminputs/PF_TimePickerInput.php M includes/forminputs/PF_TokensInput.php M includes/forminputs/PF_TreeInput.php M includes/forminputs/PF_YearInput.php 27 files changed, 0 insertions(+), 102 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms refs/changes/33/406033/1 diff --git a/includes/PF_AutoeditAPI.php b/includes/PF_AutoeditAPI.php index a403101..d0d9440 100644 --- a/includes/PF_AutoeditAPI.php +++ b/includes/PF_AutoeditAPI.php @@ -1,15 +1,11 @@ https://gerrit.wikimedia.org/r/406033 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I54ad9ac68684f558228f1b646f97da2c14674ca8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageForms Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...PageForms[master]: Add a @covers tag to the only test
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406032 ) Change subject: Add a @covers tag to the only test .. Add a @covers tag to the only test Change-Id: I16b047c965e2ebcf47576ba8b0a462d9da5783be --- M tests/phpunit/includes/PF_FormPrinterTest.php 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageForms refs/changes/32/406032/1 diff --git a/tests/phpunit/includes/PF_FormPrinterTest.php b/tests/phpunit/includes/PF_FormPrinterTest.php index 098a403..41919b3 100644 --- a/tests/phpunit/includes/PF_FormPrinterTest.php +++ b/tests/phpunit/includes/PF_FormPrinterTest.php @@ -1,6 +1,7 @@ https://gerrit.wikimedia.org/r/406032 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I16b047c965e2ebcf47576ba8b0a462d9da5783be Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageForms Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Gadgets[master]: Fix PHPDocs of GadgetDefinitionContent::getDeletionUpdates
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406031 ) Change subject: Fix PHPDocs of GadgetDefinitionContent::getDeletionUpdates .. Fix PHPDocs of GadgetDefinitionContent::getDeletionUpdates DataUpdate is a specific implementation (currently the only one), while DeferrableUpdate is the interface. Binding against the interface is enough, and what the base classes already do. I'm also removing a line of meaningless documentation. "Creates an instance of this class" is a general description that is true for all constructors. Change-Id: Ia6dc86b078628db5e0ab68ef46bf0396567b767c --- M includes/GadgetResourceLoaderModule.php M includes/content/GadgetDefinitionContent.php 2 files changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets refs/changes/31/406031/1 diff --git a/includes/GadgetResourceLoaderModule.php b/includes/GadgetResourceLoaderModule.php index e1b2602..13d16cd 100644 --- a/includes/GadgetResourceLoaderModule.php +++ b/includes/GadgetResourceLoaderModule.php @@ -16,8 +16,6 @@ private $gadget; /** -* Creates an instance of this class -* * @param array $options */ public function __construct( array $options ) { diff --git a/includes/content/GadgetDefinitionContent.php b/includes/content/GadgetDefinitionContent.php index b5aa7cf..cede38d 100644 --- a/includes/content/GadgetDefinitionContent.php +++ b/includes/content/GadgetDefinitionContent.php @@ -97,7 +97,7 @@ /** * @param WikiPage $page * @param ParserOutput $parserOutput -* @return DataUpdate[] +* @return DeferrableUpdate[] */ public function getDeletionUpdates( WikiPage $page, ParserOutput $parserOutput = null ) { return array_merge( -- To view, visit https://gerrit.wikimedia.org/r/406031 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia6dc86b078628db5e0ab68ef46bf0396567b767c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gadgets Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...BetaFeatures[master]: Add missing @covers tags to existing test cases
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406030 ) Change subject: Add missing @covers tags to existing test cases .. Add missing @covers tags to existing test cases This is quite trivial, I believe. No need to fiddle with function-level @covers tags here. Change-Id: I12027f6f98952cc8fdca5722dc75ac5c300105af --- M tests/phpunit/AutoEnrollmentTest.php M tests/phpunit/DependentFeatureTest.php M tests/phpunit/HTMLFeatureFieldTest.php M tests/phpunit/HTMLHorizontalRuleTest.php M tests/phpunit/HTMLTextBlockTest.php M tests/phpunit/HooksRunTest.php M tests/phpunit/NewHTMLCheckFieldTest.php M tests/phpunit/PreferenceHandlingTest.php 8 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BetaFeatures refs/changes/30/406030/1 diff --git a/tests/phpunit/AutoEnrollmentTest.php b/tests/phpunit/AutoEnrollmentTest.php index 3b801dd..b7c6a61 100644 --- a/tests/phpunit/AutoEnrollmentTest.php +++ b/tests/phpunit/AutoEnrollmentTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \BetaFeaturesHooks::getPreferences + * * @group BetaFeatures */ class AutoEnrollmentTest extends BetaFeaturesTestCase { diff --git a/tests/phpunit/DependentFeatureTest.php b/tests/phpunit/DependentFeatureTest.php index bc9f8bf..8e486b0 100644 --- a/tests/phpunit/DependentFeatureTest.php +++ b/tests/phpunit/DependentFeatureTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \BetaFeaturesHooks::getPreferences + * * @group BetaFeatures */ class DependentFeatureTest extends BetaFeaturesTestCase { diff --git a/tests/phpunit/HTMLFeatureFieldTest.php b/tests/phpunit/HTMLFeatureFieldTest.php index 3266e7f..b69ec16 100644 --- a/tests/phpunit/HTMLFeatureFieldTest.php +++ b/tests/phpunit/HTMLFeatureFieldTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \HTMLFeatureField + * * @group BetaFeatures */ class HTMLFeatureFieldTest extends MediaWikiTestCase { diff --git a/tests/phpunit/HTMLHorizontalRuleTest.php b/tests/phpunit/HTMLHorizontalRuleTest.php index 5b27836..2b3ce41 100644 --- a/tests/phpunit/HTMLHorizontalRuleTest.php +++ b/tests/phpunit/HTMLHorizontalRuleTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \HTMLHorizontalRuleField + * * @group BetaFeatures */ class HTMLHorizontalRuleFieldTest extends MediaWikiTestCase { diff --git a/tests/phpunit/HTMLTextBlockTest.php b/tests/phpunit/HTMLTextBlockTest.php index 3de29c8..8b4fb63 100644 --- a/tests/phpunit/HTMLTextBlockTest.php +++ b/tests/phpunit/HTMLTextBlockTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \HTMLTextBlockField + * * @group BetaFeatures */ class HTMLTextBlockFieldTest extends MediaWikiTestCase { diff --git a/tests/phpunit/HooksRunTest.php b/tests/phpunit/HooksRunTest.php index 15727e0..99e8265 100644 --- a/tests/phpunit/HooksRunTest.php +++ b/tests/phpunit/HooksRunTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \BetaFeaturesHooks::getPreferences + * * @group BetaFeatures */ class HooksRunTest extends MediaWikiTestCase { diff --git a/tests/phpunit/NewHTMLCheckFieldTest.php b/tests/phpunit/NewHTMLCheckFieldTest.php index 0f07b15..5b9bc42 100644 --- a/tests/phpunit/NewHTMLCheckFieldTest.php +++ b/tests/phpunit/NewHTMLCheckFieldTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \NewHTMLCheckField + * * @group BetaFeatures */ class NewHTMLCheckFieldTest extends MediaWikiTestCase { diff --git a/tests/phpunit/PreferenceHandlingTest.php b/tests/phpunit/PreferenceHandlingTest.php index a36532f..a522c80 100644 --- a/tests/phpunit/PreferenceHandlingTest.php +++ b/tests/phpunit/PreferenceHandlingTest.php @@ -24,6 +24,8 @@ */ /** + * @covers \BetaFeaturesHooks::getPreferences + * * @group BetaFeatures */ class PreferenceHandlingTest extends BetaFeaturesTestCase { -- To view, visit https://gerrit.wikimedia.org/r/406030 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I12027f6f98952cc8fdca5722dc75ac5c300105af Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BetaFeatures Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ 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
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 * @dataProvi
[MediaWiki-commits] [Gerrit] mediawiki...TwoColConflict[master]: [WIP] Adjust selection, reset and edit radio buttons
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406028 ) Change subject: [WIP] Adjust selection, reset and edit radio buttons .. [WIP] Adjust selection, reset and edit radio buttons Adjust the interactive elements to reflect the newest MVP. Bug: T183362 Change-Id: I5e8dcbdff4c76114f5e5aedd073a1b76bc814892 --- M composer.json M includes/CollapsedTextBuilder.php M includes/GoatTwoColConflict/HtmlGoatConflictView.php M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less 4 files changed, 51 insertions(+), 31 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoColConflict refs/changes/28/406028/1 diff --git a/composer.json b/composer.json index 5fddd6a..9015c7a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "require": { - "php": ">=5.5.9" + "php": ">=5.5.9", + "phan/phan": "0.8" }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", diff --git a/includes/CollapsedTextBuilder.php b/includes/CollapsedTextBuilder.php index ea53939..6aaea5e 100644 --- a/includes/CollapsedTextBuilder.php +++ b/includes/CollapsedTextBuilder.php @@ -11,9 +11,10 @@ * * @param string $text HTML * @param int $maxLength +* @param string $eclipse * @return string|false */ - public static function buildCollapsedText( $text, $maxLength = 150 ) { + public static function buildCollapsedText( $text, $maxLength = 150, $eclipse = '' ) { $text = self::trimWhiteSpaces( html_entity_decode( $text ) ); $lines = explode( "\n", $text ); @@ -23,9 +24,11 @@ return '' . htmlspecialchars( self::trimStringToFullWord( $lines[0], $maxLength / 2, true ) ) . + $eclipse . '' . ( count( $lines ) > 1 ? "\n" : wfMessage( 'word-separator' ) ) . '' . + $eclipse . htmlspecialchars( self::trimStringToFullWord( array_pop( $lines ), $maxLength / 2, false ) ) . diff --git a/includes/GoatTwoColConflict/HtmlGoatConflictView.php b/includes/GoatTwoColConflict/HtmlGoatConflictView.php index 72aaff8..f510c14 100644 --- a/includes/GoatTwoColConflict/HtmlGoatConflictView.php +++ b/includes/GoatTwoColConflict/HtmlGoatConflictView.php @@ -144,7 +144,7 @@ Html::rawElement( 'span', [ 'class' => 'mw-twocolconflict-goat-collapsedtext' ], - CollapsedTextBuilder::buildCollapsedText( $text ) + CollapsedTextBuilder::buildCollapsedText( $text, 150, ' ... ' ) ) . $this->buildExpandButton() ); diff --git a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less index 622a64e..fca583f 100644 --- a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less +++ b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less @@ -61,23 +61,47 @@ } .mw-twocolconflict-goat-toggle { + position: relative; margin-top: 4px; padding: 2px; - border: 2px solid #b4bac1; - border-radius: 22px; height: 22px; - background: #edeff2; + + .oo-ui-radioInputWidget { + position: absolute; + } + + .oo-ui-radioInputWidget [type="radio"] + span { + width: 1.4em; + height: 1.4em; + } + + .oo-ui-radioInputWidget:nth-of-type(1) { + left: 4px; + } + .oo-ui-radioInputWidget:nth-of-type(2) { + right: 0; + } + + .oo-ui-radioInputWidget:nth-of-type(1) [type="radio"] + span { + border-color: #ffde7f; + background: #fef7e7; + } + + .oo-ui-radioInputWidget:nth-of-type(2) [type="radio"] + span { + border-color: #729beb; + background: #ebf3fe; + } .oo-ui-radioInputWidget.oo-ui-widget-enabled:nth-of-type(1) [type="radio"]:checked + span, .oo-ui-radioInputWidget.oo-ui-widget-enabled:nth-of-type(1) [type="radio"]:active + span { - border-color: #ffd23a; - background: #ffd23a; + border: 1px solid #ac6700; + background: #ffcc33; } .oo-ui-radioInputWidget.oo-ui-widg
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityExternalValidation[master]: Update Coveralls URLs
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/406024 ) Change subject: Update Coveralls URLs .. Update Coveralls URLs See WikibaseQualityConstraints commit d5c47c137f (change I64bc71d98e). (Coveralls isn’t currently enabled for this project, but updating the URLs doesn’t hurt, either.) Also fixes the missing trailing newline. Change-Id: I33b8798c8a4957d33648b18de5930eb1790f19a9 --- M README.md 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation refs/changes/24/406024/1 diff --git a/README.md b/README.md index d8ff63b..e7311f4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Wikibase Quality External Validation [![Build Status](https://travis-ci.org/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation.svg?branch=master)] (https://travis-ci.org/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation) -[![Coverage Status](https://coveralls.io/repos/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation/badge.svg)] -(https://coveralls.io/r/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation) +[![Coverage Status](https://coveralls.io/repos/github/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation/badge.svg)] +(https://coveralls.io/github/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation/badges/quality-score.png?b=master)] (https://scrutinizer-ci.com/g/wikimedia/mediawiki-extensions-WikibaseQualityExternalValidation/?branch=master) @@ -53,4 +53,4 @@ * Last but not least, you need to fill the tables that contain external data - for that you need the [dump converter script](https://github.com/WikidataQuality/DumpConverter). Follow the instruction in the README to create a tar file (that contains a number of csv files). -Run `php maintenance/runScript.php extensions/ExternalValidation/maintenance/UpdateExternalData.php --tar-file `. \ No newline at end of file +Run `php maintenance/runScript.php extensions/ExternalValidation/maintenance/UpdateExternalData.php --tar-file `. -- To view, visit https://gerrit.wikimedia.org/r/406024 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I33b8798c8a4957d33648b18de5930eb1790f19a9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Update Coveralls URLs
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405916 ) Change subject: Update Coveralls URLs .. Update Coveralls URLs Change-Id: I64bc71d98ea5a36aa5a7e5932a80731bbec3334e --- M README.md 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/16/405916/1 diff --git a/README.md b/README.md index 4b39354..3545455 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ [travis-badge]: https://travis-ci.org/wikimedia/mediawiki-extensions-WikibaseQualityConstraints.svg?branch=master [travis]: https://travis-ci.org/wikimedia/mediawiki-extensions-WikibaseQualityConstraints -[coveralls-badge]: https://coveralls.io/repos/wikimedia/mediawiki-extensions-WikibaseQualityConstraints/badge.svg -[coveralls]: https://coveralls.io/r/wikimedia/mediawiki-extensions-WikibaseQualityConstraints +[coveralls-badge]: https://coveralls.io/repos/github/wikimedia/mediawiki-extensions-WikibaseQualityConstraints/badge.svg +[coveralls]: https://coveralls.io/github/wikimedia/mediawiki-extensions-WikibaseQualityConstraints [scrutinizer-badge]: https://scrutinizer-ci.com/g/wikimedia/mediawiki-extensions-WikibaseQualityConstraints/badges/quality-score.png?b=master [scrutinizer]: https://scrutinizer-ci.com/g/wikimedia/mediawiki-extensions-WikibaseQualityConstraints/?branch=master [wbq]: https://github.com/wikimedia/mediawiki-extensions-WikibaseQuality.git -- To view, visit https://gerrit.wikimedia.org/r/405916 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I64bc71d98ea5a36aa5a7e5932a80731bbec3334e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add notification for #wikidata-feed on IRC
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405915 ) Change subject: Add notification for #wikidata-feed on IRC .. Add notification for #wikidata-feed on IRC If the Travis build fails, or becomes successful again, post a message in #wikidata-feed. Copied from change I220b6653e7. Change-Id: Ifee21b2a6aafa9f9bcd74ec5bb427f6fb5c9415d --- M .travis.yml 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/15/405915/1 diff --git a/.travis.yml b/.travis.yml index d2c00af..333a25f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,4 +28,11 @@ - bash ./build/travis/after_script.sh notifications: + irc: +channels: + - "chat.freenode.net#wikidata-feed" +on_success: change +on_failure: always +template: + - "%{repository}/%{branch}/%{commit} : %{author} %{message} %{build_url}" slack: wikidataquality:6RzuL6LCKzoPupOKuNUhpCSt -- To view, visit https://gerrit.wikimedia.org/r/405915 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifee21b2a6aafa9f9bcd74ec5bb427f6fb5c9415d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] wikibase/property-suggester-scripts[master]: Report of travis status
Lucas Werkmeister (WMDE) has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/405911 ) Change subject: Report of travis status .. Report of travis status Change-Id: I220b6653e79de3ac082323bcfa06428fa4e4f38e --- M .travis.yml 1 file changed, 14 insertions(+), 0 deletions(-) Approvals: Lucas Werkmeister (WMDE): Verified; Looks good to me, approved diff --git a/.travis.yml b/.travis.yml index b490bbe..002a4ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,17 @@ after_success: - codecov + +notifications: +email: +recipients: +- ladsgr...@gmail.com +on_success: change +on_failure: always +irc: +channels: +- "chat.freenode.net#wikidata-feed" +on_success: change +on_failure: always +template: +- "%{repository}/%{branch}/%{commit} : %{author} %{message} %{build_url}" -- To view, visit https://gerrit.wikimedia.org/r/405911 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I220b6653e79de3ac082323bcfa06428fa4e4f38e Gerrit-PatchSet: 1 Gerrit-Project: wikibase/property-suggester-scripts Gerrit-Branch: master Gerrit-Owner: Ladsgroup Gerrit-Reviewer: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Don’t load gadget when not in edit mode
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405904 ) Change subject: Don’t load gadget when not in edit mode .. Don’t load gadget when not in edit mode If Wikibase is not in edit mode – for example, because we’re on a diff page, or on an older revision – don’t show constraint reports either. (Note that wbIsEditView is a page-wide property, independent of user permissions: if a registered user lacks permissions to edit a protected page, it still makes sense to show them constraint violations, since they can at least alert others to them on talk pages or project chat.) Bug: T184623 Change-Id: Ic169e8e34ae2a291f24b17c6fab680af161be6e7 --- M modules/gadget-skip.js M modules/gadget.js M src/WikibaseQualityConstraintsHooks.php 3 files changed, 6 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/04/405904/1 diff --git a/modules/gadget-skip.js b/modules/gadget-skip.js index 3921674..cdc2b58 100644 --- a/modules/gadget-skip.js +++ b/modules/gadget-skip.js @@ -1 +1 @@ -return !mw.config.exists( 'wbEntityId' ) || mw.config.get( 'wgMFMode' ); +return !mw.config.exists( 'wbEntityId' ) || mw.config.get( 'wgMFMode' ) || !mw.config.get( 'wbIsEditView' ); diff --git a/modules/gadget.js b/modules/gadget.js index da4d542..0983a7d 100644 --- a/modules/gadget.js +++ b/modules/gadget.js @@ -291,8 +291,8 @@ entityId = mw.config.get( 'wbEntityId' ); - if ( entityId === null || mw.config.get( 'wgMFMode' ) ) { - // no entity or mobile frontend, skip + if ( entityId === null || mw.config.get( 'wgMFMode' ) || !mw.config.get( 'wbIsEditView' ) ) { + // no entity, mobile frontend, or not editing (diff, oldid, …) – skip return; } diff --git a/src/WikibaseQualityConstraintsHooks.php b/src/WikibaseQualityConstraintsHooks.php index 1dd1de7..71f32af 100644 --- a/src/WikibaseQualityConstraintsHooks.php +++ b/src/WikibaseQualityConstraintsHooks.php @@ -132,6 +132,9 @@ if ( !$out->getUser()->isLoggedIn() ) { return; } + if ( !$out->getJsConfigVars()['wbIsEditView'] ) { + return; + } if ( self::isGadgetEnabledForUserName( $out->getUser()->getName(), time() ) ) { $out->addModules( 'wikibase.quality.constraints.gadget' ); -- To view, visit https://gerrit.wikimedia.org/r/405904 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic169e8e34ae2a291f24b17c6fab680af161be6e7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Don’t use NewStatement to build standalone snaks
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405897 ) Change subject: Don’t use NewStatement to build standalone snaks .. Don’t use NewStatement to build standalone snaks Using NewStatement::…->build()->getMainSnak() just to construct a Snak is a cute trick, sure, but it’s actually longer than just constructing the PropertyId and Snak objects directly :) Bug: T168240 Change-Id: I67bcadf917073b7619bd90cdbfe0e3cb6a06ae1f --- M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php M tests/phpunit/Context/QualifierContextTest.php M tests/phpunit/Context/ReferenceContextTest.php 4 files changed, 43 insertions(+), 36 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/97/405897/1 diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php index 683b37d..0b71096 100644 --- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php @@ -2,7 +2,10 @@ namespace WikibaseQuality\ConstraintReport\Test\ValueCountChecker; +use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Reference; +use Wikibase\DataModel\Snak\PropertyNoValueSnak; +use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\Repo\Tests\NewItem; use Wikibase\Repo\Tests\NewStatement; use WikibaseQuality\ConstraintReport\Constraint; @@ -78,8 +81,8 @@ } public function testMultiValueConstraint_One_Qualifier() { - $qualifier1 = NewStatement::noValueFor( 'P1' )->build()->getMainSnak(); - $qualifier2 = NewStatement::noValueFor( 'P2' )->build()->getMainSnak(); + $qualifier1 = new PropertyNoValueSnak( new PropertyId( 'P1' ) ); + $qualifier2 = new PropertyNoValueSnak( new PropertyId( 'P2' ) ); $statement = NewStatement::someValueFor( 'P10' )->build(); $statement->getQualifiers()->addSnak( $qualifier1 ); $statement->getQualifiers()->addSnak( $qualifier2 ); @@ -94,8 +97,8 @@ } public function testMultiValueConstraint_Two_Reference() { - $referenceSnak1 = NewStatement::noValueFor( 'P1' )->build()->getMainSnak(); - $referenceSnak2 = NewStatement::someValueFor( 'P1' )->build()->getMainSnak(); + $referenceSnak1 = new PropertyNoValueSnak( new PropertyId( 'P1' ) ); + $referenceSnak2 = new PropertySomeValueSnak( new PropertyId( 'P1' ) ); $reference = new Reference( [ $referenceSnak1, $referenceSnak2 ] ); $statement = NewStatement::someValueFor( 'P10' )->build(); $statement->getReferences()->addReference( $reference ); diff --git a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php index 6afd45d..4a0e53c 100644 --- a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php @@ -2,7 +2,10 @@ namespace WikibaseQuality\ConstraintReport\Test\ValueCountChecker; +use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Reference; +use Wikibase\DataModel\Snak\PropertyNoValueSnak; +use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\Repo\Tests\NewItem; use Wikibase\Repo\Tests\NewStatement; use WikibaseQuality\ConstraintReport\Constraint; @@ -78,8 +81,8 @@ } public function testSingleValueConstraint_One_Qualifier() { - $qualifier1 = NewStatement::noValueFor( 'P1' )->build()->getMainSnak(); - $qualifier2 = NewStatement::noValueFor( 'P2' )->build()->getMainSnak(); + $qualifier1 = new PropertyNoValueSnak( new PropertyId( 'P1' ) ); + $qualifier2 = new PropertyNoValueSnak( new PropertyId( 'P2' ) ); $statement = NewStatement::someValueFor( 'P10' )->build(); $statement->getQualifiers()->addSnak( $qualifier1 ); $statement->getQualifiers()->addSnak( $qualifier2 ); @@ -94,8 +97,8 @@ } public function testSingleValueConstraint_Two_Reference() { - $referenceSnak1 = NewStatement::noValueFor( 'P1' )->build()->getMainSnak(); - $referenceSnak2 = NewStatement::someValueFor( 'P1' )->build()->getMainSnak(); + $referenceSnak1 = new PropertyNoValueSnak
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Fix smaller mistakes in UsageDeduplicator
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405895 ) Change subject: Fix smaller mistakes in UsageDeduplicator .. Fix smaller mistakes in UsageDeduplicator Bug: T178079 Change-Id: I72fe1aeb3df2d36f322e6579994584f88aa0e4a8 --- M client/includes/Usage/UsageDeduplicator.php M client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php 2 files changed, 27 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/95/405895/1 diff --git a/client/includes/Usage/UsageDeduplicator.php b/client/includes/Usage/UsageDeduplicator.php index 10c5feb..8c7e4ce 100644 --- a/client/includes/Usage/UsageDeduplicator.php +++ b/client/includes/Usage/UsageDeduplicator.php @@ -25,9 +25,8 @@ $return = []; array_walk_recursive( $structuredUsages, - function( $a ) use ( &$return ) { - /* @var EntityUsage $a */ - $return[$a->getIdentityString()] = $a; + function ( EntityUsage $usage ) use ( &$return ) { + $return[$usage->getIdentityString()] = $usage; } ); return $return; @@ -65,8 +64,8 @@ } /** -* @param EntityUsage[] $usages -* @return EntityUsage[] +* @param array[] $usages +* @return array[] */ private function deduplicateUsagesPerEntity( array $usages ) { $usages[EntityUsage::DESCRIPTION_USAGE] = $this->deduplicatePerType( diff --git a/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php b/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php index cf2041e..a536369 100644 --- a/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php +++ b/client/tests/phpunit/includes/Usage/UsageDeduplicatorTest.php @@ -31,19 +31,35 @@ $q2DescriptionFa = new EntityUsage( $q2, EntityUsage::DESCRIPTION_USAGE, 'fa' ); return [ - [ [ $q1LabelEn, $q1Label ], [ $q1Label ] ], - [ [ $q1LabelEn ], [ $q1LabelEn ] ], - [ [ $q1LabelEn, $q1Label, $q2Description, $q1All ], [ $q1Label, $q1All, $q2Description ] ], - [ [ $q1LabelEn, $q2Label, $q1Statement ], [ $q1LabelEn, $q1Statement, $q2Label ] ], - [ [ $q2DescriptionFa, $q2Description, $q1All ], [ $q2Description, $q1All ] ], + [ + [ $q1LabelEn, $q1Label ], + [ $q1Label ] + ], + [ + [ $q1LabelEn ], + [ $q1LabelEn ] + ], + [ + [ $q1Label, $q1LabelEn, $q2Description, $q1All ], + [ $q1Label, $q2Description, $q1All ] + ], + [ + [ $q1LabelEn, $q2Label, $q1Statement ], + [ $q1LabelEn, $q2Label, $q1Statement ] + ], + [ + [ $q2Description, $q2DescriptionFa, $q1All ], + [ $q2Description, $q1All ] + ], ]; } /** -* @covers \Wikibase\Client\Usage\UsageDeduplicator::deduplicate * @dataProvider provideDeduplicate +* @param EntityUsage[] $usages +* @param EntityUsage[] $output */ - public function testDeduplicate( $usages, $output ) { + public function testDeduplicate( array $usages, array $output ) { $expected = []; foreach ( $output as $usage ) { $expected[$usage->getIdentityString()] = $usage; -- To view, visit https://gerrit.wikimedia.org/r/405895 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I72fe1aeb3df2d36f322e6579994584f88aa0e4a8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Rearrange UsageDeduplicator implementation
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405896 ) Change subject: Rearrange UsageDeduplicator implementation .. Rearrange UsageDeduplicator implementation This is basically the exact same implementation, just moved around a bit. I found the way the code was previously arranged not that optimal. The code was spread out quite a lot. Significant changes are: * The actual deduplication intentionally replaces an array of usages with a single usage. This makes the later array_walk_recursive run faster because it does have less 1-element arrays to iterate. * The actual deduplication use &-references to manipulate the one array, instead of constantly constructing new ones. * Structuring is done in one step instead of two. $array[$foo][$bar][] works just fine here. * Note that labels and descriptions are not mentioned any more! The same deduplication logic is applied to all aspects, not only labels and descriptions. This might be a mistake, but no test fails. If you think this is a mistake, please add a test that demonstrates why. Bug: T178079 Change-Id: Ic8ec86088d49b5979a78e99d2cafce5f6c86f94d --- M client/includes/Usage/UsageDeduplicator.php 1 file changed, 37 insertions(+), 47 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/96/405896/1 diff --git a/client/includes/Usage/UsageDeduplicator.php b/client/includes/Usage/UsageDeduplicator.php index 8c7e4ce..a9126dc 100644 --- a/client/includes/Usage/UsageDeduplicator.php +++ b/client/includes/Usage/UsageDeduplicator.php @@ -12,81 +12,71 @@ /** * @param EntityUsage[] $usages +* * @return EntityUsage[] */ public function deduplicate( array $usages ) { - $structuredUsages = $this->structureUsages( $usages ); - - foreach ( $structuredUsages as $entityId => $usages ) { - $structuredUsages[$entityId] = $this->deduplicateUsagesPerEntity( $usages ); - } - - // Flatten the structured array - $return = []; - array_walk_recursive( - $structuredUsages, - function ( EntityUsage $usage ) use ( &$return ) { - $return[$usage->getIdentityString()] = $usage; - } + return $this->flattenStructuredUsages( + $this->deduplicateStructuredUsages( + $this->structureUsages( $usages ) + ) ); - return $return; } /** * @param EntityUsage[] $usages -* @return array[] +* +* @return array[] three-dimensional array of +* [ $entityId => [ $aspectKey => [ EntityUsage $usage, … ], … ], … ] */ private function structureUsages( array $usages ) { $structuredUsages = []; - foreach ( $usages as $usage ) { - $entityId = $usage->getEntityId(); - $structuredUsages[$entityId->getSerialization()][] = $usage; - } - return array_map( [ $this, 'structureUsagesPerEntity' ], $structuredUsages ); - } - - /** -* @param EntityUsage[] $usages -* @return array[] -*/ - private function structureUsagesPerEntity( array $usages ) { - $structuredUsages = [ - EntityUsage::DESCRIPTION_USAGE => [], - EntityUsage::LABEL_USAGE => [], - ]; foreach ( $usages as $usage ) { + $entityId = $usage->getEntityId()->getSerialization(); $aspect = $usage->getAspect(); - $structuredUsages[$aspect][] = $usage; + $structuredUsages[$entityId][$aspect][] = $usage; } return $structuredUsages; } /** -* @param array[] $usages +* @param array[] $structuredUsages +* * @return array[] */ - private function deduplicateUsagesPerEntity( array $usages ) { - $usages[EntityUsage::DESCRIPTION_USAGE] = $this->deduplicatePerType( - $usages[EntityUsage::DESCRIPTION_USAGE] - ); - $usages[EntityUsage::LABEL_USAGE] = $this->deduplicatePerType( - $usages[EntityUsage::LABEL_USAGE] - ); - return $usages; + private function deduplicateStructuredUsages( array $structuredUsages ) { + foreach ( $structuredUsages as &$usagesPerEntity ) { + /** @var EntityUsage[] $usagesPerT
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Expand ReferenceContextTest::testGetSnakGroup
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405893 ) Change subject: Expand ReferenceContextTest::testGetSnakGroup .. Expand ReferenceContextTest::testGetSnakGroup This expands the test for ReferenceContext::getSnakGroup() to make sure that the function doesn’t look at qualifiers of the statement, or any any part of completely unrelated other statements. Previously, we only checked that the function didn’t look at other references. Bug: T168240 Change-Id: Idc7b6d44e10c4b0b9471f915474cd4d136daa4dc --- M tests/phpunit/Context/ReferenceContextTest.php 1 file changed, 16 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/93/405893/1 diff --git a/tests/phpunit/Context/ReferenceContextTest.php b/tests/phpunit/Context/ReferenceContextTest.php index 5d9ec29..2d25500 100644 --- a/tests/phpunit/Context/ReferenceContextTest.php +++ b/tests/phpunit/Context/ReferenceContextTest.php @@ -6,6 +6,8 @@ use Wikibase\DataModel\Reference; use Wikibase\DataModel\ReferenceList; use Wikibase\DataModel\Snak\PropertyNoValueSnak; +use Wikibase\DataModel\Snak\PropertySomeValueSnak; +use Wikibase\DataModel\Snak\SnakList; use Wikibase\DataModel\Statement\Statement; use Wikibase\Repo\Tests\NewItem; use Wikibase\Repo\Tests\NewStatement; @@ -85,17 +87,26 @@ public function testGetSnakGroup() { $referenceSnak1 = NewStatement::noValueFor( 'P100' )->build()->getMainSnak(); $referenceSnak2 = NewStatement::someValueFor( 'P200' )->build()->getMainSnak(); + $referenceSnak3 = NewStatement::noValueFor( 'P300' )->build()->getMainSnak(); + $referenceSnak4 = NewStatement::someValueFor( 'P400' )->build()->getMainSnak(); $reference1 = new Reference( [ $referenceSnak1, $referenceSnak2 ] ); - $reference2 = new Reference( [ new PropertyNoValueSnak( new PropertyId( 'P300' ) ) ] ); - $statement = new Statement( + $reference2 = new Reference( [ $referenceSnak3 ] ); + $reference3 = new Reference( [ $referenceSnak4 ] ); + $statement1 = new Statement( new PropertyNoValueSnak( new PropertyId( 'P1' ) ), - null, + /* qualifiers = */ new SnakList( [ $referenceSnak3 ] ), new ReferenceList( [ $reference1, $reference2 ] ) ); + $statement2 = new Statement( + new PropertySomeValueSnak( new PropertyId( 'P2' ) ), + null, + new ReferenceList( [ $reference2, $reference3 ] ) + ); $entity = NewItem::withId( 'Q1' ) - ->andStatement( $statement ) + ->andStatement( $statement1 ) + ->andStatement( $statement2 ) ->build(); - $context = new ReferenceContext( $entity, $statement, $reference1, $referenceSnak1 ); + $context = new ReferenceContext( $entity, $statement1, $reference1, $referenceSnak1 ); $snakGroup = $context->getSnakGroup(); -- To view, visit https://gerrit.wikimedia.org/r/405893 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idc7b6d44e10c4b0b9471f915474cd4d136daa4dc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Rewrite ConstraintParameterRendererTest::assertConstraintRep...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405877 ) Change subject: Rewrite ConstraintParameterRendererTest::assertConstraintReportParameterList .. Rewrite ConstraintParameterRendererTest::assertConstraintReportParameterList Instead of fiddling with $expected and constructing a pretty complex array (and by doing so repeating parts of the implementation from ConstraintParameterRenderer), I turn it around and rip $actual appart to compare it. This also fixes an actual mistake with an array key. Bug: T169121 Change-Id: Ic8715c3338fe0b42314639519a524c1b50896e29 --- M tests/phpunit/ConstraintParameterRendererTest.php 1 file changed, 8 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/77/405877/1 diff --git a/tests/phpunit/ConstraintParameterRendererTest.php b/tests/phpunit/ConstraintParameterRendererTest.php index 14ce764..a5278bd 100644 --- a/tests/phpunit/ConstraintParameterRendererTest.php +++ b/tests/phpunit/ConstraintParameterRendererTest.php @@ -555,7 +555,7 @@ ); $this->assertConstraintReportParameterList( - array_fill( 0, 10, 'statement' ) + [ 11 => '...' ], + array_fill( 0, 10, 'statement' ) + [ 10 => '...' ], $formatted ); } @@ -565,11 +565,13 @@ * @param string $actual */ private function assertConstraintReportParameterList( array $expected, $actual ) { - $htmlList = '' . implode( '', array_map( function ( $item ) { - return "$item"; - }, $expected ) ) . ''; - array_unshift( $expected, $htmlList ); - $this->assertSame( $expected, $actual ); + $htmlList = ''; + foreach ( $expected as $item ) { + $htmlList .= "$item"; + } + $htmlList .= ''; + $this->assertSame( $htmlList, $actual[0] ); + $this->assertSame( $expected, array_slice( $actual, 1 ) ); } } -- To view, visit https://gerrit.wikimedia.org/r/405877 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic8715c3338fe0b42314639519a524c1b50896e29 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Remove not needed Statements from Multi/SingleValueChecker t...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405875 ) Change subject: Remove not needed Statements from Multi/SingleValueChecker tests .. Remove not needed Statements from Multi/SingleValueChecker tests Bug: T175566 Change-Id: I6802e7ecdd2638c4f0112798a6eafb57c3a5c873 --- M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php 2 files changed, 2 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/75/405875/1 diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php index cfdd52d..d80e567 100644 --- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php @@ -83,9 +83,7 @@ $statement = NewStatement::someValueFor( 'P10' )->build(); $statement->getQualifiers()->addSnak( $qualifier1 ); $statement->getQualifiers()->addSnak( $qualifier2 ); - $item = NewItem::withStatement( $statement ) - ->andStatement( NewStatement::someValueFor( 'P1' ) ) - ->build(); + $item = NewItem::withStatement( $statement )->build(); $context = new QualifierContext( $item, $statement, $qualifier1 ); $checkResult = $this->checker->checkConstraint( $context, $this->constraint ); diff --git a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php index 7d4404f..5ae7df5 100644 --- a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php @@ -83,9 +83,7 @@ $statement = NewStatement::someValueFor( 'P10' )->build(); $statement->getQualifiers()->addSnak( $qualifier1 ); $statement->getQualifiers()->addSnak( $qualifier2 ); - $item = NewItem::withStatement( $statement ) - ->andStatement( NewStatement::someValueFor( 'P1' ) ) - ->build(); + $item = NewItem::withStatement( $statement )->build(); $context = new QualifierContext( $item, $statement, $qualifier1 ); $checkResult = $this->checker->checkConstraint( $context, $this->constraint ); -- To view, visit https://gerrit.wikimedia.org/r/405875 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6802e7ecdd2638c4f0112798a6eafb57c3a5c873 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Remove not needed …->withSomeGuid() calls from tests
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405874 ) Change subject: Remove not needed …->withSomeGuid() calls from tests .. Remove not needed …->withSomeGuid() calls from tests These calls have been introduced with I0fced66. They do, in fact, not make any difference. At least for now. This might change with future patches (e.g. "upcoming changes to ValueCountCheckerHelper" have been mentioned). I want to leave this here as a reminder to recheck when this happened. Bug: T168240 Change-Id: Ie5a7652d609721cf91a5619cc89b35101601dd51 --- M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php 2 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/74/405874/1 diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php index cfdd52d..683b37d 100644 --- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php @@ -44,7 +44,7 @@ } public function testMultiValueConstraint_One() { - $statement = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement = NewStatement::noValueFor( 'P1' )->build(); $item = NewItem::withStatement( $statement )->build(); $context = new MainSnakContext( $item, $statement ); @@ -54,8 +54,8 @@ } public function testMultiValueConstraint_Two() { - $statement1 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); - $statement2 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement1 = NewStatement::noValueFor( 'P1' )->build(); + $statement2 = NewStatement::noValueFor( 'P1' )->build(); $item = NewItem::withStatement( $statement1 )->andStatement( $statement2 )->build(); $context = new MainSnakContext( $item, $statement1 ); @@ -65,10 +65,10 @@ } public function testMultiValueConstraint_TwoButOneDeprecated() { - $statement1 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement1 = NewStatement::noValueFor( 'P1' )->build(); $statement2 = NewStatement::noValueFor( 'P1' ) ->withDeprecatedRank() - ->withSomeGuid()->build(); + ->build(); $item = NewItem::withStatement( $statement1 )->andStatement( $statement2 )->build(); $context = new MainSnakContext( $item, $statement1 ); @@ -110,7 +110,7 @@ public function testSingleValueConstraintDeprecatedStatement() { $statement = NewStatement::noValueFor( 'P1' ) ->withDeprecatedRank() - ->withSomeGuid()->build(); + ->build(); $entity = NewItem::withId( 'Q1' ) ->build(); $context = new MainSnakContext( $entity, $statement ); diff --git a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php index 7d4404f..6afd45d 100644 --- a/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php @@ -44,7 +44,7 @@ } public function testSingleValueConstraint_One() { - $statement = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement = NewStatement::noValueFor( 'P1' )->build(); $item = NewItem::withStatement( $statement )->build(); $context = new MainSnakContext( $item, $statement ); @@ -54,8 +54,8 @@ } public function testSingleValueConstraint_Two() { - $statement1 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); - $statement2 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement1 = NewStatement::noValueFor( 'P1' )->build(); + $statement2 = NewStatement::noValueFor( 'P1' )->build(); $item = NewItem::withStatement( $statement1 )->andStatement( $statement2 )->build(); $context = new MainSnakContext( $item, $statement1 ); @@ -65,10 +65,10 @@
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Extract ConstraintParameterRendererTest::assertConstraintRep...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405872 ) Change subject: Extract ConstraintParameterRendererTest::assertConstraintReportParameterList .. Extract ConstraintParameterRendererTest::assertConstraintReportParameterList Bug: T169121 Change-Id: Ic51b3283b3419b35b4068b331d00afe3216b3835 --- M tests/phpunit/ConstraintParameterRendererTest.php 1 file changed, 34 insertions(+), 113 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/72/405872/1 diff --git a/tests/phpunit/ConstraintParameterRendererTest.php b/tests/phpunit/ConstraintParameterRendererTest.php index 3af26f0..14ce764 100644 --- a/tests/phpunit/ConstraintParameterRendererTest.php +++ b/tests/phpunit/ConstraintParameterRendererTest.php @@ -279,7 +279,7 @@ $formatted = $constraintParameterRenderer->formatPropertyIdList( [] ); - $this->assertSame( [ '' ], $formatted ); + $this->assertConstraintReportParameterList( [], $formatted ); } public function testFormatPropertyIdList_TwoPropertyIds() { @@ -294,7 +294,7 @@ new PropertyId( 'P2' ), ] ); - $this->assertSame( [ 'P1P2', 'P1', 'P2' ], $formatted ); + $this->assertConstraintReportParameterList( [ 'P1', 'P2' ], $formatted ); } public function testFormatPropertyIdList_TwentyPropertyIds() { @@ -313,25 +313,8 @@ ) ); - $this->assertSame( - [ - '' . - 'P1P2P3P4P5' . - 'P6P7P8P9P10' . - '...' . - '', - 'P1', - 'P2', - 'P3', - 'P4', - 'P5', - 'P6', - 'P7', - 'P8', - 'P9', - 'P10', - '...', - ], + $this->assertConstraintReportParameterList( + [ 'P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7', 'P8', 'P9', 'P10', '...' ], $formatted ); } @@ -345,7 +328,7 @@ $formatted = $constraintParameterRenderer->formatItemIdList( [] ); - $this->assertSame( [ '' ], $formatted ); + $this->assertConstraintReportParameterList( [], $formatted ); } public function testFormatItemIdList_TwoItemIds() { @@ -360,7 +343,7 @@ new ItemId( 'Q2' ), ] ); - $this->assertSame( [ 'Q1Q2', 'Q1', 'Q2' ], $formatted ); + $this->assertConstraintReportParameterList( [ 'Q1', 'Q2' ], $formatted ); } public function testFormatItemIdList_TwentyItemIds() { @@ -379,25 +362,8 @@ ) ); - $this->assertSame( - [ - '' . - 'Q1Q2Q3Q4Q5' . - 'Q6Q7Q8Q9Q10' . - '...' . - '', - 'Q1', - 'Q2', - 'Q3', - 'Q4', - 'Q5', - 'Q6', - 'Q7', - 'Q8', - 'Q9', - 'Q10', - '...', - ], + $this->assertConstraintReportParameterList( + [ 'Q1', 'Q2', 'Q3', 'Q4', 'Q5', 'Q6', 'Q7', 'Q8', 'Q9', 'Q10', '...' ],
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Improve type hints in Checkers and remove redundant PHPDoc
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405868 ) Change subject: Improve type hints in Checkers and remove redundant PHPDoc .. Improve type hints in Checkers and remove redundant PHPDoc The majority of this patch removes PHPDoc blocks that repeat 100% exactly what the method header already states. But this is only minor cleanup and not the meat of this patch. Please also review Ie157941, which does the same in the WikibaseQualityExternalValidation extension. Change-Id: I7408a465e7750f0ecf4c2bb30d380a7943aecb34 --- M src/ConstraintCheck/Checker/CommonsLinkChecker.php M src/ConstraintCheck/Checker/ConflictsWithChecker.php M src/ConstraintCheck/Checker/DiffWithinRangeChecker.php M src/ConstraintCheck/Checker/InverseChecker.php M src/ConstraintCheck/Checker/ItemChecker.php M src/ConstraintCheck/Checker/OneOfChecker.php M src/ConstraintCheck/Checker/RangeChecker.php M src/ConstraintCheck/Checker/SymmetricChecker.php M src/ConstraintCheck/Checker/TargetRequiredClaimChecker.php M src/ConstraintCheck/Checker/TypeChecker.php M src/ConstraintCheck/Checker/ValueTypeChecker.php M src/ConstraintCheck/Context/AbstractContext.php M src/ConstraintCheck/Context/MainSnakContext.php M src/ConstraintCheck/DelegatingConstraintChecker.php M src/Specials/SpecialConstraintReport.php 15 files changed, 9 insertions(+), 94 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/68/405868/1 diff --git a/src/ConstraintCheck/Checker/CommonsLinkChecker.php b/src/ConstraintCheck/Checker/CommonsLinkChecker.php index 928e257..64a84bd 100644 --- a/src/ConstraintCheck/Checker/CommonsLinkChecker.php +++ b/src/ConstraintCheck/Checker/CommonsLinkChecker.php @@ -36,11 +36,6 @@ */ private $titleParser; - /** -* @param ConstraintParameterParser $constraintParameterParser -* @param ConstraintParameterRenderer $constraintParameterRenderer -* @param TitleParser $titleParser -*/ public function __construct( ConstraintParameterParser $constraintParameterParser, ConstraintParameterRenderer $constraintParameterRenderer, diff --git a/src/ConstraintCheck/Checker/ConflictsWithChecker.php b/src/ConstraintCheck/Checker/ConflictsWithChecker.php index 8035d09..10380d8 100644 --- a/src/ConstraintCheck/Checker/ConflictsWithChecker.php +++ b/src/ConstraintCheck/Checker/ConflictsWithChecker.php @@ -41,12 +41,6 @@ */ private $constraintParameterRenderer; - /** -* @param EntityLookup $lookup -* @param ConstraintParameterParser $constraintParameterParser -* @param ConnectionCheckerHelper $connectionCheckerHelper -* @param ConstraintParameterRenderer $constraintParameterRenderer -*/ public function __construct( EntityLookup $lookup, ConstraintParameterParser $constraintParameterParser, diff --git a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php index f516bbd..1e7af11 100644 --- a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php +++ b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php @@ -43,12 +43,6 @@ */ private $config; - /** -* @param ConstraintParameterParser $constraintParameterParser -* @param RangeCheckerHelper $rangeCheckerHelper -* @param ConstraintParameterRenderer $constraintParameterRenderer -* @param Config $config -*/ public function __construct( ConstraintParameterParser $constraintParameterParser, RangeCheckerHelper $rangeCheckerHelper, diff --git a/src/ConstraintCheck/Checker/InverseChecker.php b/src/ConstraintCheck/Checker/InverseChecker.php index b600fc2..a54258d 100644 --- a/src/ConstraintCheck/Checker/InverseChecker.php +++ b/src/ConstraintCheck/Checker/InverseChecker.php @@ -44,12 +44,6 @@ */ private $constraintParameterRenderer; - /** -* @param EntityLookup $lookup -* @param ConstraintParameterParser $constraintParameterParser -* @param ConnectionCheckerHelper $connectionCheckerHelper -* @param ConstraintParameterRenderer $constraintParameterRenderer -*/ public function __construct( EntityLookup $lookup, ConstraintParameterParser $constraintParameterParser, diff --git a/src/ConstraintCheck/Checker/ItemChecker.php b/src/ConstraintCheck/Checker/ItemChecker.php index c085b87..cd38685 100644 --- a/src/ConstraintCheck/Checker/ItemChecker.php +++ b/src/ConstraintCheck/Checker/ItemChecker.php @@ -40,12 +40,6 @@ */ private $constraintParameterRenderer; - /** -* @param EntityLookup $lookup -* @param ConstraintParameterParser
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQuality[master]: Remove redundant @package tags
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405866 ) Change subject: Remove redundant @package tags .. Remove redundant @package tags See WikibaseQualityConstraints commit 0d5c5e7156 (change Ib0a0cb771d). Change-Id: I09576b8a1a73d9d0aa7536441e206e32b8f15cd9 --- M includes/Html/HtmlTableBuilder.php M includes/Html/HtmlTableCellBuilder.php M includes/Html/HtmlTableHeaderBuilder.php 3 files changed, 0 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQuality refs/changes/66/405866/1 diff --git a/includes/Html/HtmlTableBuilder.php b/includes/Html/HtmlTableBuilder.php index c1009ad..d6aa1a6 100644 --- a/includes/Html/HtmlTableBuilder.php +++ b/includes/Html/HtmlTableBuilder.php @@ -7,7 +7,6 @@ use Wikimedia\Assert\Assert; /** - * @package WikibaseQuality\Html * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/Html/HtmlTableCellBuilder.php b/includes/Html/HtmlTableCellBuilder.php index 96ccdf7..574c68d 100644 --- a/includes/Html/HtmlTableCellBuilder.php +++ b/includes/Html/HtmlTableCellBuilder.php @@ -7,7 +7,6 @@ use Wikimedia\Assert\Assert; /** - * @package WikibaseQuality\Html * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/Html/HtmlTableHeaderBuilder.php b/includes/Html/HtmlTableHeaderBuilder.php index ffbb931..2c0ad75 100644 --- a/includes/Html/HtmlTableHeaderBuilder.php +++ b/includes/Html/HtmlTableHeaderBuilder.php @@ -7,7 +7,6 @@ use Wikimedia\Assert\Assert; /** - * @package WikibaseQuality\Html * @author BP2014N1 * @license GNU GPL v2+ */ -- To view, visit https://gerrit.wikimedia.org/r/405866 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I09576b8a1a73d9d0aa7536441e206e32b8f15cd9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQuality Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Collection[master]: Improve type hints in documentation
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405863 ) Change subject: Improve type hints in documentation .. Improve type hints in documentation Change-Id: I1f235d128e3fdf1f78a66eab1b7c942a60b5897b --- M CollectionProposals.php M CollectionSuggest.php M includes/MessageBoxHelper.php 3 files changed, 23 insertions(+), 51 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection refs/changes/63/405863/1 diff --git a/CollectionProposals.php b/CollectionProposals.php index 177a285..a539ede 100644 --- a/CollectionProposals.php +++ b/CollectionProposals.php @@ -21,8 +21,6 @@ */ /** - * class: CollectionProposals - * * it needs 3 Lists: * - one with the bookmembers * - one where it can save the banned articles @@ -39,26 +37,29 @@ class CollectionProposals { /** -* == -* class attributes -* == -* -* only mLinkList and mPropList can be accessed from -* outside the class via getLinkList() and getPropsosals() +* @var array */ private $mColl; + + /** +* @var array[] +*/ private $mPropList; + + /** +* @var array[] +*/ private $mLinkList; + + /** +* @var string[] +*/ private $mBanList; /** -* == -* constructor -* == -* * @param array $coll the collection -* @param array $ban the list of the banned articles -* @param array $props the list of the proposals +* @param string[] $ban the list of the banned articles +* @param array[] $props the list of the proposals */ public function __construct( $coll, $ban, $props ) { $this->mPropList = []; @@ -68,13 +69,7 @@ } /** -* == -* public methods -* == -*/ - - /** -* @return array +* @return array[] */ public function getLinkList() { return $this->mLinkList; @@ -83,7 +78,7 @@ /** * @param array $collection */ - public function setCollection( $collection ) { + public function setCollection( array $collection ) { $this->mColl = $collection; } @@ -97,7 +92,7 @@ * @param bool $doUpdate when true, $linkList will *updated before calculating the proposals *default is true -* @return array a 2-dimensional array that contains the proposals +* @return array[] a 2-dimensional array that contains the proposals * the first dimesion is numeric, the second contains * 3 entries: * - 'name': the name of a proposed article @@ -126,12 +121,6 @@ public function hasBans() { return count( $this->mBanList ) > 0; } - - /** -* == -* private methods -* == -*/ private function updateLinkList() { $this->addCollectionArticles(); @@ -200,7 +189,7 @@ * * @param int $num_articles * @param string $wikitext article text -* @return array with links and their weights +* @return float[] with links and their weights */ private function getWeightedLinks( $num_articles, $wikitext ) { global $wgCollectionSuggestCheapWeightThreshhold; @@ -364,7 +353,7 @@ * if the array doesn't contain the article * * @param string $entry an articlename -* @param array $array to be searched, it has to 2-dimensional +* @param array[] $array to be searched, it has to 2-dimensional * the 2nd dimension needs the key 'name' * @return bool|int the key as integer or false */ diff --git a/CollectionSuggest.php b/CollectionSuggest.php index 858e42e..c5ece82 100644 --- a/CollectionSuggest.php +++ b/CollectionSuggest.php @@ -21,19 +21,12 @@ */ /** - * Class: CollectionSuggest - * * This class contains only static methods, so theres no need for a constructer. * When the page Special:Book/suggest/ is loaded the method run() is called. * Ajax calles refresh(). * When clearing a book the method clear() should be called. */ class CollectionSuggest { - /** -* ==
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityExternalValidation[master]: Remove all @package documentation tags
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405861 ) Change subject: Remove all @package documentation tags .. Remove all @package documentation tags These tags are from a time when namespaces did not existed in PHP. They do nothing but literally repeating the namespace. Let's please get rid of them. No other project I'm aware of uses them any more. Change-Id: I68b9679d3cd2de7587d06f8bde1daf4cacb0f4e0 --- M api/RunCrossCheck.php M includes/CrossCheck/Comparer/DataValueComparer.php M includes/CrossCheck/Comparer/DataValueComparerFactory.php M includes/CrossCheck/Comparer/DispatchingDataValueComparer.php M includes/CrossCheck/Comparer/EntityIdValueComparer.php M includes/CrossCheck/Comparer/GlobeCoordinateValueComparer.php M includes/CrossCheck/Comparer/MonolingualTextValueComparer.php M includes/CrossCheck/Comparer/MultilingualTextValueComparer.php M includes/CrossCheck/Comparer/QuantityValueComparer.php M includes/CrossCheck/Comparer/StringComparer.php M includes/CrossCheck/Comparer/StringValueComparer.php M includes/CrossCheck/Comparer/TimeValueComparer.php M includes/CrossCheck/CrossCheckInteractor.php M includes/CrossCheck/CrossChecker.php M includes/CrossCheck/ReferenceChecker.php M includes/CrossCheck/Result/ComparisonResult.php M includes/CrossCheck/Result/CrossCheckResult.php M includes/CrossCheck/Result/CrossCheckResultList.php M includes/CrossCheck/Result/ReferenceResult.php M includes/CrossCheck/ValueParser/ComparativeValueParser.php M includes/CrossCheck/ValueParser/ComparativeValueParserFactory.php M includes/CrossCheck/ValueParser/MultilingualTextValueParser.php M includes/DumpMetaInformation/DumpMetaInformation.php M includes/DumpMetaInformation/DumpMetaInformationLookup.php M includes/DumpMetaInformation/DumpMetaInformationStore.php M includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php M includes/ExternalDataRepo.php M includes/ExternalValidationServices.php M includes/Serializer/ComparisonResultSerializer.php M includes/Serializer/CrossCheckResultListSerializer.php M includes/Serializer/CrossCheckResultSerializer.php M includes/Serializer/DumpMetaInformationSerializer.php M includes/Serializer/IndexedTagsSerializer.php M includes/Serializer/ReferenceResultSerializer.php M includes/Serializer/SerializerFactory.php M includes/UpdateExternalData/CsvImportSettings.php M includes/UpdateExternalData/ExternalDataImporter.php M maintenance/UpdateExternalData.php 38 files changed, 0 insertions(+), 41 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation refs/changes/61/405861/1 diff --git a/api/RunCrossCheck.php b/api/RunCrossCheck.php index 54bd122..fab0617 100644 --- a/api/RunCrossCheck.php +++ b/api/RunCrossCheck.php @@ -20,7 +20,6 @@ /** * API module that performs cross-checks of entities or claims. * - * @package WikibaseQuality\ExternalValidation\Api * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/CrossCheck/Comparer/DataValueComparer.php b/includes/CrossCheck/Comparer/DataValueComparer.php index 983c7c0..c1c7b57 100644 --- a/includes/CrossCheck/Comparer/DataValueComparer.php +++ b/includes/CrossCheck/Comparer/DataValueComparer.php @@ -5,8 +5,6 @@ use DataValues\DataValue; /** - * Interface DataValueComparer - * @package WikibaseQuality\ExternalValidation\CrossCheck\Comparer * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/CrossCheck/Comparer/DataValueComparerFactory.php b/includes/CrossCheck/Comparer/DataValueComparerFactory.php index d510a18..a6f4f4f 100644 --- a/includes/CrossCheck/Comparer/DataValueComparerFactory.php +++ b/includes/CrossCheck/Comparer/DataValueComparerFactory.php @@ -6,7 +6,6 @@ use Wikibase\TermIndex; /** - * @package WikibaseQuality\ExternalValidation\CrossCheck\Comparer * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/CrossCheck/Comparer/DispatchingDataValueComparer.php b/includes/CrossCheck/Comparer/DispatchingDataValueComparer.php index ad5e100..5078f71 100644 --- a/includes/CrossCheck/Comparer/DispatchingDataValueComparer.php +++ b/includes/CrossCheck/Comparer/DispatchingDataValueComparer.php @@ -6,7 +6,6 @@ use InvalidArgumentException; /** - * @package WikibaseQuality\ExternalValidation\CrossCheck\Comparer * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/CrossCheck/Comparer/EntityIdValueComparer.php b/includes/CrossCheck/Comparer/EntityIdValueComparer.php index 9eb07a1..a664f16 100644 --- a/includes/CrossCheck/Comparer/EntityIdValueComparer.php +++ b/includes/CrossCheck/Comparer/EntityIdValueComparer.php @@ -12,7 +12,6 @@ /** * @fixme This class does not compares EntityIdValues! - * @package WikibaseQuality\ExternalValidation\CrossCheck\Comparer * @author BP2014N1 * @license GNU GPL v2+ */ diff --git a/includes/CrossChec
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Use MediaWiki\restoreWarnings in deprecated wfRestoreWarnings
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405741 ) Change subject: Use MediaWiki\restoreWarnings in deprecated wfRestoreWarnings .. Use MediaWiki\restoreWarnings in deprecated wfRestoreWarnings This will give devs a better hint on how to replace this. Change-Id: I2332b6173b7816aef11841725752745e174fa69f --- M includes/GlobalFunctions.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/41/405741/1 diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index b181628..a06d721 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2021,7 +2021,7 @@ * Restore error level to previous value */ function wfRestoreWarnings() { - MediaWiki\suppressWarnings( true ); + MediaWiki\restoreWarnings(); } /** -- To view, visit https://gerrit.wikimedia.org/r/405741 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2332b6173b7816aef11841725752745e174fa69f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: [WIP] Update Wikibase CodeSniffer to 0.3.x
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405735 ) Change subject: [WIP] Update Wikibase CodeSniffer to 0.3.x .. [WIP] Update Wikibase CodeSniffer to 0.3.x The only controversial detail I can see for now is if we really want a sniff that disallows "list ()" with a space. Personally I don't mind. Please state your opionin at https://github.com/wmde/WikibaseCodeSniffer/pull/18 Change-Id: I7f9c192cb51057685e0d67742bb8446d995308a8 --- R client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php M composer.json M phpcs.xml M repo/includes/Api/EntitySearchTermIndex.php M repo/tests/phpunit/includes/Api/EditEntityTest.php M repo/tests/phpunit/includes/Api/SetAliasesTest.php M repo/tests/phpunit/includes/Api/SetDescriptionTest.php M repo/tests/phpunit/includes/Api/SetLabelTest.php M repo/tests/phpunit/includes/Api/SetSiteLinkTest.php 9 files changed, 22 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/35/405735/1 diff --git a/client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortalHandlerTest.php b/client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php similarity index 100% rename from client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortalHandlerTest.php rename to client/tests/phpunit/includes/Hooks/BaseTemplateAfterPortletHandlerTest.php diff --git a/composer.json b/composer.json index df88468..5fda6e4 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": ">=0.3 <0.10", - "wikibase/wikibase-codesniffer": "^0.2.0", + "wikibase/wikibase-codesniffer": "^0.3.0", "jakub-onderka/php-console-highlighter": "0.3.2", "mediawiki/minus-x": "0.2.1" }, diff --git a/phpcs.xml b/phpcs.xml index 757ccc1..d1f49f3 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,8 +1,6 @@ - - - - + + @@ -17,7 +15,14 @@ WikibaseClient\.example\.php - + + /maintenance/ + build/generateAutoload\.php + repo/tests/testDispatchCoordinator\.php + + Wikibase*\.hooks\.php + + Scribunto_LuaWikibaseLibraryTestCase @@ -26,8 +31,6 @@ Scribunto_LuaWikibase*Library - - @@ -39,6 +42,7 @@ . + repo/tests/browser view/lib/wikibase-api/WikibaseJavaScriptApi.php ^extensions/ diff --git a/repo/includes/Api/EntitySearchTermIndex.php b/repo/includes/Api/EntitySearchTermIndex.php index 1cff8f2..48f2525 100644 --- a/repo/includes/Api/EntitySearchTermIndex.php +++ b/repo/includes/Api/EntitySearchTermIndex.php @@ -198,7 +198,7 @@ // NOTE: this assumes entities of the particular type are only provided by a single repository // This assumption is currently valid but might change in the future. - list ( $repositoryPrefix, ) = $this->entityTypeToRepositoryMapping[$entityType][0]; + list( $repositoryPrefix, ) = $this->entityTypeToRepositoryMapping[$entityType][0]; try { $id = $this->idParser->parse( EntityId::joinSerialization( [ diff --git a/repo/tests/phpunit/includes/Api/EditEntityTest.php b/repo/tests/phpunit/includes/Api/EditEntityTest.php index 94287c0..e2ac3a5 100644 --- a/repo/tests/phpunit/includes/Api/EditEntityTest.php +++ b/repo/tests/phpunit/includes/Api/EditEntityTest.php @@ -485,7 +485,7 @@ 'new' => 'item', 'data' => '{"labels":{"en":{"language":"en","value":"something"}}}' ]; - list ( $result, ) = $this->doApiRequestWithToken( $createItemParams, null, $user ); + list( $result, ) = $this->doApiRequestWithToken( $createItemParams, null, $user ); return $result['entity']; } diff --git a/repo/tests/phpunit/includes/Api/SetAliasesTest.php b/repo/tests/phpunit/includes/Api/SetAliasesTest.php index 33cf152..e01cbb8 100644 --- a/repo/tests/phpunit/includes/Api/SetAliasesTest.php +++ b/repo/tests/phpunit/includes/Api/SetAliasesTest.php @@ -273,7 +273,7 @@ $newItem = $this->createItemUsing( $userWithAllPermissions ); - li
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Mark all Lexeme API modules as "internal"
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405732 ) Change subject: Mark all Lexeme API modules as "internal" .. Mark all Lexeme API modules as "internal" MediaWiki core does have an other idea of what "internal" means than the team developing the Lexeme codebase does. For core, "internal" is nothing but a message on the help page for the API module. This does not hide the module in any way. Change-Id: I29720dd35204384ee44dfa441e7b65d264bbdd62 --- M src/Api/AddForm.php M src/Api/EditFormElements.php 2 files changed, 16 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/32/405732/1 diff --git a/src/Api/AddForm.php b/src/Api/AddForm.php index 0cec37a..4a84036 100644 --- a/src/Api/AddForm.php +++ b/src/Api/AddForm.php @@ -238,6 +238,14 @@ } /** +* As long as this codebase is in development and APIs might change any time without notice, we +* mark all as internal. This adds an "unstable" notice, but does not hide them in any way. +*/ + public function isInternal() { + return true; + } + + /** * @see ApiBase::needsToken() */ public function needsToken() { diff --git a/src/Api/EditFormElements.php b/src/Api/EditFormElements.php index 5eb2068..7a9f1bd 100644 --- a/src/Api/EditFormElements.php +++ b/src/Api/EditFormElements.php @@ -196,6 +196,14 @@ } /** +* As long as this codebase is in development and APIs might change any time without notice, we +* mark all as internal. This adds an "unstable" notice, but does not hide them in any way. +*/ + public function isInternal() { + return true; + } + + /** * @see ApiBase::needsToken() */ public function needsToken() { -- To view, visit https://gerrit.wikimedia.org/r/405732 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I29720dd35204384ee44dfa441e7b65d264bbdd62 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Update php-coveralls
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405731 ) Change subject: Update php-coveralls .. Update php-coveralls There are two things going on here. Firstly, the binary was renamed from coveralls to php-coveralls, which we need to account for in our Travis script. However, this binary cannot actually be found in the satooshi/php-coveralls package – composer prints a warning about that. I’m not sure what the php-coveralls folks have done here, but in any event, using the new package name php-coveralls/php-coveralls seems to fix the problem (it was apparently renamed at some point as well). Change-Id: I7ee5100d447176acbeeae3c50af5c304ef688e55 --- M build/travis/after_script.sh M composer.json 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/31/405731/1 diff --git a/build/travis/after_script.sh b/build/travis/after_script.sh index 1b74a26..a37904a 100755 --- a/build/travis/after_script.sh +++ b/build/travis/after_script.sh @@ -2,4 +2,4 @@ cd ../wiki/extensions/WikibaseQualityConstraints -php vendor/bin/coveralls -v +php vendor/bin/php-coveralls -v diff --git a/composer.json b/composer.json index c836b1d..d5bf7b2 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "jakub-onderka/php-console-highlighter": "0.3.2", "jakub-onderka/php-parallel-lint": "0.9.2", "phpunit/phpunit": "~4.8", - "satooshi/php-coveralls": "master-dev", + "php-coveralls/php-coveralls": "master-dev", "wikibase/wikibase-codesniffer": "^0.2.0", "mediawiki/minus-x": "0.2.1" }, -- To view, visit https://gerrit.wikimedia.org/r/405731 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7ee5100d447176acbeeae3c50af5c304ef688e55 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...TwoColConflict[master]: [WIP] Show error message in prototype if not all versions ha...
Andrew-WMDE has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405730 ) Change subject: [WIP] Show error message in prototype if not all versions have been selected .. [WIP] Show error message in prototype if not all versions have been selected Bug: T183363 Change-Id: I3126dcd5bfae77499503701d294d5d5a4ef833ba --- M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js M modules/GoatTwoColConflict/ext.TwoColConflict.Goat.less 2 files changed, 88 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TwoColConflict refs/changes/30/405730/1 diff --git a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js index 3df9e7b..817fce6 100644 --- a/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js +++ b/modules/GoatTwoColConflict/ext.TwoColConflict.Goat.init.js @@ -1,28 +1,73 @@ ( function ( mw, $ ) { - // TODO refactor to avoid this being double in the inits - function disableEditButtons() { - if ( mw.config.get( 'wgTwoColConflictTestMode' ) ) { - OO.ui.infuse( 'wpTestPreviewWidget' ).setDisabled( true ); - return; - } - OO.ui.infuse( 'wpSaveWidget' ).setDisabled( true ); - OO.ui.infuse( 'wpPreviewWidget' ).setDisabled( true ); - OO.ui.infuse( 'wpDiffWidget' ).setDisabled( true ); + function markRowsWithSwitches( $switches ) { + var $rowsWithSwitches = $switches.closest( '.mw-twocolconflict-goat-row' ); + + $rowsWithSwitches.each( + function () { + $( this ).attr( 'incomplete', true ); + } + ); } - function enableEditButtons() { - if ( mw.config.get( 'wgTwoColConflictTestMode' ) ) { - OO.ui.infuse( 'wpTestPreviewWidget' ).setDisabled( false ); - return; + function checkForCompletion( event, $btn ) { + var $rows = $( '.mw-twocolconflict-goat-view' ).children( '.mw-twocolconflict-goat-row' ), + $incompleteRows = false, + $editOptionsSection = $btn.closest( '.editOptions' ), + $msgSection = $editOptionsSection.find( '.mw-twocolconflict-goat-row-incomplete-error-text' ), + $msg; + + $rows.each( + function () { + if ( $( this ).attr( 'incomplete' ) === 'true' ) { + $( this ).addClass( 'mw-twocolconflict-goat-row-incomplete' ); + $incompleteRows = true; + } else { + $( this ).removeClass( 'mw-twocolconflict-goat-row-incomplete' ); + } + } ); + + if ( $incompleteRows ) { + $msg = $( '' ) + .addClass( 'mw-twocolconflict-goat-row-incomplete-error-text' ); + + $msg.append( + $( '' ).text( 'There are paragraphs you didn\'t choose a version for. Please select one for each paragraph.' ) + ); + + $msg.append( + $( '' ).text( 'Show me unselected paragraphs -->' ).on( 'click', function () { + document.getElementsByClassName( 'mw-twocolconflict-goat-row-incomplete' )[ 0 ].scrollIntoView(); + } ) + ); + + if ( $msgSection.length === 0 ) { + $editOptionsSection.append( $msg ); + } else { + $msgSection.html( $msg ); + } + + event.preventDefault(); } - OO.ui.infuse( 'wpSaveWidget' ).setDisabled( false ); - OO.ui.infuse( 'wpPreviewWidget' ).setDisabled( false ); - OO.ui.infuse( 'wpDiffWidget' ).setDisabled( false ); } - function oneOptionPerSwitchIsSelected( $switches ) { - return $switches.find( 'input:checked' ).length === - $switches.find( 'input' ).length / 2; + function reConfigureSubmitButton() { + if ( mw.config.get( 'wgTwoColConflictTestMode
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[wmf/1.31.0-wmf.17]: Add missing DISTINCT to SPARQL query
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405728 ) Change subject: Add missing DISTINCT to SPARQL query .. Add missing DISTINCT to SPARQL query Bug: T184705 Change-Id: Ie76949e4b85e9529b5b721691e5e6e5b8c46d319 (cherry picked from commit e6e6d4f34422c921e0c4246534fb315b69d433ad) --- M src/ConstraintCheck/Helper/SparqlHelper.php M tests/phpunit/Helper/SparqlHelperTest.php 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/28/405728/1 diff --git a/src/ConstraintCheck/Helper/SparqlHelper.php b/src/ConstraintCheck/Helper/SparqlHelper.php index 3855258..db7dc49 100644 --- a/src/ConstraintCheck/Helper/SparqlHelper.php +++ b/src/ConstraintCheck/Helper/SparqlHelper.php @@ -179,7 +179,7 @@ } $query = <<getMock(); $query = <<getMock(); $query = <<https://gerrit.wikimedia.org/r/405728 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie76949e4b85e9529b5b721691e5e6e5b8c46d319 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: wmf/1.31.0-wmf.17 Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Use list() without space before the parenthesis
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405726 ) Change subject: Use list() without space before the parenthesis .. Use list() without space before the parenthesis The `list ()` variant will be forbidden once the underlying MediaWiki ruleset is updated to 0.11.1 (part of wmde/WikibaseCodeSniffer#18, expected to become wikibase/wikibase-codesniffer 0.3.0). Change-Id: Id79298185cba92f66220ad0738552f478e7ca4a1 --- M src/ConstraintCheck/Checker/CommonsLinkChecker.php M src/ConstraintCheck/Checker/DiffWithinRangeChecker.php M src/ConstraintCheck/Helper/SparqlHelper.php 3 files changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/26/405726/1 diff --git a/src/ConstraintCheck/Checker/CommonsLinkChecker.php b/src/ConstraintCheck/Checker/CommonsLinkChecker.php index 928e257..c091c23 100644 --- a/src/ConstraintCheck/Checker/CommonsLinkChecker.php +++ b/src/ConstraintCheck/Checker/CommonsLinkChecker.php @@ -146,7 +146,7 @@ if ( !$this->commonsLinkIsWellFormed( $commonsLink ) ) { throw new MalformedTitleException( 'wbqc-violation-message-commons-link-not-well-formed', $commonsLink ); // caught below } - list ( $defaultNamespace, $prefix ) = $this->getCommonsNamespace( $namespace ); + list( $defaultNamespace, $prefix ) = $this->getCommonsNamespace( $namespace ); $title = $this->titleParser->parseTitle( $prefix . $commonsLink, $defaultNamespace ); if ( $this->pageExists( $title ) ) { $message = ''; diff --git a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php index f516bbd..d1c74ca 100644 --- a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php +++ b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php @@ -159,7 +159,7 @@ $minuend = $snak->getDataValue(); /** @var PropertyId $property */ - list ( $min, $max, $property, $parameters ) = $this->parseConstraintParameters( $constraint ); + list( $min, $max, $property, $parameters ) = $this->parseConstraintParameters( $constraint ); // checks only the first occurrence of the referenced property (this constraint implies a single value constraint on that property) /** @var Statement $otherStatement */ diff --git a/src/ConstraintCheck/Helper/SparqlHelper.php b/src/ConstraintCheck/Helper/SparqlHelper.php index 54bf3f7..86e851b 100644 --- a/src/ConstraintCheck/Helper/SparqlHelper.php +++ b/src/ConstraintCheck/Helper/SparqlHelper.php @@ -220,7 +220,7 @@ $dataType = $this->propertyDataTypeLookup->getDataTypeIdForProperty( $snak->getPropertyId() ); - list ( $value, $isFullValue ) = $this->getRdfLiteral( $dataType, $dataValue ); + list( $value, $isFullValue ) = $this->getRdfLiteral( $dataType, $dataValue ); if ( $isFullValue ) { $prefix .= 'v'; } -- To view, visit https://gerrit.wikimedia.org/r/405726 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id79298185cba92f66220ad0738552f478e7ca4a1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Rename @dataProvider methods to provide…()
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405724 ) Change subject: Rename @dataProvider methods to provide…() .. Rename @dataProvider methods to provide…() According to MediaWiki guidelines [1], the name of a data provider should begin with “provide”. Previously, we used several styles inconsistently in this extension (mostly “get…Provider”). This commit brings them all in line with the MediaWiki guidelines. In my opinion, this sometimes makes the tests more readable as well, since the method name now documents what it actually provides, not just what the test method to which it belongs is called. [1]: https://www.mediawiki.org/wiki/Special:PermanentLink/2678449#Data_providers Bug: T168240 Change-Id: I51f476ff74cf2abd4934f2568268b429f0c39651 --- M tests/phpunit/Cache/CachingMetadataTest.php M tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php M tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php M tests/phpunit/Checker/RangeChecker/RangeCheckerTest.php M tests/phpunit/Checker/ReferenceCheckerTest.php M tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php M tests/phpunit/Checker/ValueOnlyCheckerTest.php M tests/phpunit/Helper/LoggingHelperTest.php M tests/phpunit/Helper/SparqlHelperTest.php M tests/phpunit/Specials/SpecialConstraintReportTest.php M tests/phpunit/WikibaseQualityConstraintsHooksTest.php 11 files changed, 32 insertions(+), 32 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/24/405724/1 diff --git a/tests/phpunit/Cache/CachingMetadataTest.php b/tests/phpunit/Cache/CachingMetadataTest.php index 7d35290..8fee5dd 100644 --- a/tests/phpunit/Cache/CachingMetadataTest.php +++ b/tests/phpunit/Cache/CachingMetadataTest.php @@ -118,7 +118,7 @@ } /** -* @dataProvider arrayRoundTripProvider +* @dataProvider provideCachingMetadata */ public function testOfArray_RoundTrip( CachingMetadata $cm ) { $array = $cm->toArray(); @@ -127,7 +127,7 @@ $this->assertEquals( $cm, $cm_ ); } - public function arrayRoundTripProvider() { + public function provideCachingMetadata() { return [ [ CachingMetadata::fresh() ], [ CachingMetadata::ofMaximumAgeInSeconds( 52 ) ], diff --git a/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php b/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php index 0d6796b..4cdc91b 100644 --- a/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php +++ b/tests/phpunit/Checker/QualifierChecker/QualifierCheckerTest.php @@ -37,7 +37,7 @@ /** * @param string $type context type * @param string|null $messageKey key of violation message, or null if compliance is expected -* @dataProvider contextTypes +* @dataProvider provideContextTypes */ public function testQualifierConstraint( $type, $messageKey ) { $context = $this->getMock( Context::class ); @@ -54,7 +54,7 @@ } } - public function contextTypes() { + public function provideContextTypes() { return [ [ Context::TYPE_STATEMENT, 'wbqc-violation-message-qualifier' ], [ Context::TYPE_QUALIFIER, null ], diff --git a/tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php b/tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php index 32053bf..67caac5 100644 --- a/tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php +++ b/tests/phpunit/Checker/RangeChecker/RangeCheckerHelperTest.php @@ -41,7 +41,7 @@ } /** -* @dataProvider getComparisonProvider +* @dataProvider provideComparisons */ public function testGetComparison( $expected, DataValue $lhs, DataValue $rhs ) { $this->assertContains( $expected, [ -1, 0, 1 ], '$expected must be -1, 0, or 1' ); @@ -60,7 +60,7 @@ } } - public function getComparisonProvider() { + public function provideComparisons() { $cases = [ [ -1, $this->getTimeValue( 1970 ), $this->getTimeValue( 1971 ) ], [ 0, $this->getTimeValue( 1970 ), $this->getTimeValue( 1970 ) ], @@ -80,7 +80,7 @@ } /** -* @dataProvider getDifferenceProvider +* @dataProvider provideDifferences */ public function testGetDifference( $expected, DataValue $minuend, DataValue $subtrahend ) { $rangeCheckHelper = $this->getRangeCheckerHelper(); @@ -89,7 +89,7 @@ $this->assertSame( (float)$expected, $actual ); } - public function
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add tests for ConstraintParameterRenderer
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405721 ) Change subject: Add tests for ConstraintParameterRenderer .. Add tests for ConstraintParameterRenderer This adds tests for all the methods of ConstraintParameterRenderer which are called by constraint checkers or ConstraintParameterParser. On the other hand, the formatValue and formatParameters methods are only used for the special page (and by the API if the “detail” and “detailHTML” fields are included), and might be removed completely depending on the outcome of T185091. Bug: T169121 Change-Id: Ifb48530ac0fe26ec1866a8c766c7198a5853d9bc --- A tests/phpunit/ConstraintParameterRendererTest.php 1 file changed, 654 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/21/405721/1 diff --git a/tests/phpunit/ConstraintParameterRendererTest.php b/tests/phpunit/ConstraintParameterRendererTest.php new file mode 100644 index 000..0bd1edc --- /dev/null +++ b/tests/phpunit/ConstraintParameterRendererTest.php @@ -0,0 +1,654 @@ +assertSame( $value, $formatted ); + } + + public function testFormatByRole_Subject() { + $role = Role::SUBJECT; + $value = 'foo assertSame( + ''. $value . '', + $formatted + ); + } + + public function testFormatDataValue() { + $role = Role::OBJECT; + $value = new StringValue( 'a test string' ); + $valueFormatter = $this->getMock( ValueFormatter::class ); + $valueFormatter->expects( $this->once() ) + ->method( 'format' ) + ->with( $value ) + ->willReturn( 'a test string' ); + $constraintParameterRenderer = new ConstraintParameterRenderer( + new PlainEntityIdFormatter(), + $valueFormatter, + $this->getDefaultConfig() + ); + + $formatted = $constraintParameterRenderer->formatDataValue( $value, $role ); + + $this->assertSame( + '' . + 'a test string' . + '', + $formatted + ); + } + + public function testFormatEntityId() { + $role = Role::PREDICATE; + $value = new PropertyId( 'P1234' ); + $entityIdFormatter = $this->getMock( EntityIdFormatter::class ); + $entityIdFormatter->expects( $this->once() ) + ->method( 'formatEntityId' ) + ->with( $value ) + ->willReturn( 'some property' ); + $constraintParameterRenderer = new ConstraintParameterRenderer( + $entityIdFormatter, + new StringFormatter(), + $this->getDefaultConfig() + ); + + $formatted = $constraintParameterRenderer->formatEntityId( $value, $role ); + + $this->assertSame( + '' . + 'some property' . + '', + $formatted + ); + } + + public function testFormatPropertyId_PropertyId() { + $value = new PropertyId( 'P1234' ); + $constraintParameterRenderer = $this->getMockBuilder( ConstraintParameterRenderer::class ) + ->disableOriginalConstructor() + ->setMethods( [ 'formatEntityId' ] ) + ->getMock(); + $constraintParameterRenderer->expects( $this->once() ) + ->method( 'formatEntityId' ) + ->with( $value ) + ->willReturn( 'some property' ); + + $formatted = $constraintParameterRenderer->formatPropertyId( $value ); + + $this->assertSame( 'some property', $formatted ); + } + + public function testFormatPropertyId_PropertyIdSerialization() { + $value = 'P1234'; + $constraintParameterRenderer = $this->getMockBuilder( ConstraintParameterRenderer::class ) + ->disableOriginalConstructor() + ->setMethods( [ 'formatEntityId' ] ) + ->getMock(); + $constraintParameterRenderer->expects(
[MediaWiki-commits] [Gerrit] mediawiki...wikidiff2[master]: [WIP] Associate new lines with upper paragraph
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405700 ) Change subject: [WIP] Associate new lines with upper paragraph .. [WIP] Associate new lines with upper paragraph This changes the way lines are split initially for the table view. When an empty new line is found, the new line char will be added as part of the upper line/paragraph and the split is done afterwards. This will make most diffs look more intuitve. ToDo: - Make removing an empty line visible - Fix line number counting Bug: T184531 Change-Id: I412c153e4ea61599bac457e3c3f2a2e6cded2cd9 --- M TableDiff.cpp M TableDiff.h M Wikidiff2.h M tests/001.phpt M tests/007.phpt M tests/008.phpt 6 files changed, 84 insertions(+), 84 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/php/wikidiff2 refs/changes/00/405700/1 diff --git a/TableDiff.cpp b/TableDiff.cpp index 964f1c8..a30ebfd 100644 --- a/TableDiff.cpp +++ b/TableDiff.cpp @@ -2,6 +2,28 @@ #include "Wikidiff2.h" #include "TableDiff.h" +void TableDiff::explodeLines(const String & text, StringVector &lines) +{ + String::const_iterator ptr = text.begin(); + while (ptr != text.end()) { + String::const_iterator ptr2 = std::find(ptr, text.end(), '\n'); + String::const_iterator ptr3 = std::next(ptr2); + + // Treat empty new lines as part of the paragraph above + if ( *ptr3 == '\n' ) { + ++ptr2; + lines.push_back(String(ptr, std::next(ptr3))); + } else { + lines.push_back(String(ptr, ptr2)); + } + + ptr = ptr2; + if (ptr != text.end()) { + ++ptr; + } + } +} + void TableDiff::printAdd(const String & line) { result += "\n" diff --git a/TableDiff.h b/TableDiff.h index 9ec560d..5fc4053 100644 --- a/TableDiff.h +++ b/TableDiff.h @@ -14,6 +14,8 @@ void printContext(const String& input); void printWordDiffSide(WordDiff& worddiff, bool added); + + void explodeLines(const String & text, StringVector &lines); }; #endif diff --git a/Wikidiff2.h b/Wikidiff2.h index 185bfb6..cb8b554 100644 --- a/Wikidiff2.h +++ b/Wikidiff2.h @@ -16,7 +16,7 @@ #include #include -#define WIKIDIFF2_VERSION_STRING "1.5.4" +#define WIKIDIFF2_VERSION_STRING "1.5.5" class Wikidiff2 { public: @@ -68,7 +68,7 @@ void printText(const String & input); void debugPrintWordDiff(WordDiff & worddiff); - void explodeLines(const String & text, StringVector &lines); + virtual void explodeLines(const String & text, StringVector &lines); bool printMovedLineDiff(StringDiff & linediff, int opIndex, int opLine, int maxMovedLines); }; diff --git a/tests/001.phpt b/tests/001.phpt index 716d470..ab4f1fd 100644 --- a/tests/001.phpt +++ b/tests/001.phpt @@ -126,15 +126,13 @@ - == Added line == + == Added line == + + - == Added line == - - - - - - + == Added line == + + @@ -143,15 +141,13 @@ - == Removed line == + == Removed line == + + - == Removed line == - - - - - - + == Removed line == + + − @@ -386,13 +382,11 @@ − - blah blah blah 1 + blah blah blah 1 + + + - blah blah blah 2 - - - - - - + blah blah blah 2 + + diff --git a/tests/007.phpt b/tests/007.phpt index f37fe16..40b44fb 100644 --- a/tests/007.phpt +++ b/tests/007.phpt @@ -43,72 +43,60 @@ - ⚫ - Substance, in the truest and primary and most definite sense of the word, is that which is neither predicable of a subject nor present in a subject; for instance, the individual man or horse. But in a secondary sense those things are called substances within which, as species, the primary substances are included; also those which, as genera, include the species. For instance, the individual man is included in the species 'man', and the genus to which the species belongs is 'animal'; these, therefore—that is to say, the species 'man' and the genus 'animal,-are termed secondary substances. - - - - − - + ⚫ + Substance, in the truest and primary and most definite sense of the word, is that which is neither predicable of a subject nor present in a subject; for instance, the individual man or horse. But in a secondary sense those things are called substances within which, as species, the primary substances are included; also those which, as genera, include the species. For instance, the individual man is included in the species 'man', and the genus to which the species belon
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Fix incomplete Form diffing not covering adding/removal of F...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405697 ) Change subject: Fix incomplete Form diffing not covering adding/removal of Forms .. Fix incomplete Form diffing not covering adding/removal of Forms Forms can not only change, Forms can also be added and removed. This was just not covered by the code yet. The diff failed hard with quite extreme exceptions. This becomes obvious very easily if you try to compare two different Lexemes, e.g. …?oldid=…&diff=… with two revision IDs from two different Lexemes. (Which is a quite typical use case, e.g. if two entities are duplicates and the user wants to compare the two.) Bug: T185477 Change-Id: I9ba8622f5b060d76a7915d9bd74383b39d76fb3f --- M src/DataModel/Services/Diff/FormDiffer.php M src/DataModel/Services/Diff/LexemeDiffer.php M src/Diff/FormDiffView.php 3 files changed, 58 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/97/405697/1 diff --git a/src/DataModel/Services/Diff/FormDiffer.php b/src/DataModel/Services/Diff/FormDiffer.php index f869063..6f2fa4e 100644 --- a/src/DataModel/Services/Diff/FormDiffer.php +++ b/src/DataModel/Services/Diff/FormDiffer.php @@ -4,13 +4,15 @@ use Diff\Differ\MapDiffer; use Diff\DiffOp\Diff\Diff; -use DomainException; use InvalidArgumentException; use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Services\Diff\EntityDiff; use Wikibase\DataModel\Services\Diff\EntityDifferStrategy; use Wikibase\DataModel\Services\Diff\StatementListDiffer; +use Wikibase\DataModel\Term\Term; +use Wikibase\DataModel\Term\TermList; use Wikibase\Lexeme\DataModel\Form; +use Wikibase\Lexeme\DataModel\FormId; /** * @license GPL-2.0+ @@ -42,8 +44,8 @@ } /** -* @param EntityDocument $from -* @param EntityDocument $to +* @param Form $from +* @param Form $to * * @return EntityDiff * @throws InvalidArgumentException @@ -57,30 +59,40 @@ } /** -* @param EntityDocument $entity +* @param Form $form * * @return EntityDiff * @throws InvalidArgumentException */ - public function getConstructionDiff( EntityDocument $entity ) { - throw new DomainException( 'Forms aren\'t stored as separate wiki pages, and can only show ' - . 'up in regular diffs that add or remove a Form' ); + public function getConstructionDiff( EntityDocument $form ) { + if ( !( $form instanceof Form ) ) { + throw new InvalidArgumentException( 'Can only diff Forms' ); + } + + return $this->diff( $this->newEmptyForm( $form->getId() ), $form ); } /** -* @param EntityDocument $entity +* @param Form $form * * @return EntityDiff * @throws InvalidArgumentException */ - public function getDestructionDiff( EntityDocument $entity ) { - throw new DomainException( 'Forms aren\'t stored as separate wiki pages, and can only show ' - . 'up in regular diffs that add or remove a Form' ); + public function getDestructionDiff( EntityDocument $form ) { + if ( !( $form instanceof Form ) ) { + throw new InvalidArgumentException( 'Can only diff Forms' ); + } + + return $this->diff( $form, $this->newEmptyForm( $form->getId() ) ); + } + + private function newEmptyForm( FormId $id ) { + $form = new Form( $id, new TermList( [ new Term( 'dummy', 'dummy' ) ] ), [] ); + $form->getRepresentations()->clear(); + return $form; } /** -* @deprecated use self::diffEntities instead -* * @param Form $old * @param Form $new * diff --git a/src/DataModel/Services/Diff/LexemeDiffer.php b/src/DataModel/Services/Diff/LexemeDiffer.php index 1494c7e..e59fdce 100644 --- a/src/DataModel/Services/Diff/LexemeDiffer.php +++ b/src/DataModel/Services/Diff/LexemeDiffer.php @@ -4,7 +4,10 @@ use Diff\Differ\MapDiffer; use Diff\DiffOp\Diff\Diff; +use Diff\DiffOp\DiffOpAdd; use Diff\DiffOp\DiffOpChange; +use Diff\DiffOp\DiffOpRemove; +use LogicException; use UnexpectedValueException; use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Services\Diff\EntityDiff; @@ -153,7 +156,7 @@ * @param FormSet $from * @param FormSet $to * -* @return Diff; +* @return Diff */ private function getFormsDiff( FormSet $from, FormSet $to ) { $differ = new MapDiffer(); @@ -16
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Fix violation of using package private serializer implementa...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405689 ) Change subject: Fix violation of using package private serializer implementations .. Fix violation of using package private serializer implementations These two implementations are marked as "package private", which means it is actually forbidden to instantiate or use them in any way that sidesteps the public methods provided by the serializer factory. This is not some personal opinion or anything I came up with, but clearly marked in the contract of the Wikibase DataModel Serialization component. Bug: T178994 Change-Id: I4cb1591c626c4b0a8b6b32a4dc1da7244baa3c5a --- M src/DataModel/Serialization/FormSerializer.php M tests/phpunit/composer/DataModel/Serialization/ExternalLexemeSerializerTest.php M tests/phpunit/composer/DataModel/Serialization/StorageLexemeSerializerTest.php 3 files changed, 9 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/89/405689/1 diff --git a/src/DataModel/Serialization/FormSerializer.php b/src/DataModel/Serialization/FormSerializer.php index e7350b5..facc3cc 100644 --- a/src/DataModel/Serialization/FormSerializer.php +++ b/src/DataModel/Serialization/FormSerializer.php @@ -2,9 +2,8 @@ namespace Wikibase\Lexeme\DataModel\Serialization; +use Serializers\Serializer; use Wikibase\DataModel\Entity\ItemId; -use Wikibase\DataModel\Serializers\StatementListSerializer; -use Wikibase\DataModel\Serializers\TermListSerializer; use Wikibase\Lexeme\DataModel\Form; /** @@ -13,18 +12,18 @@ class FormSerializer { /** -* @var TermListSerializer +* @var Serializer */ private $termListSerializer; /** -* @var StatementListSerializer +* @var Serializer */ private $statementListSerializer; public function __construct( - TermListSerializer $termListSerializer, - StatementListSerializer $statementListSerializer + Serializer $termListSerializer, + Serializer $statementListSerializer ) { $this->termListSerializer = $termListSerializer; $this->statementListSerializer = $statementListSerializer; diff --git a/tests/phpunit/composer/DataModel/Serialization/ExternalLexemeSerializerTest.php b/tests/phpunit/composer/DataModel/Serialization/ExternalLexemeSerializerTest.php index d71a3b2..898e263 100644 --- a/tests/phpunit/composer/DataModel/Serialization/ExternalLexemeSerializerTest.php +++ b/tests/phpunit/composer/DataModel/Serialization/ExternalLexemeSerializerTest.php @@ -4,10 +4,9 @@ use PHPUnit_Framework_TestCase; use Serializers\Exceptions\SerializationException; +use Serializers\Serializer; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\PropertyId; -use Wikibase\DataModel\Serializers\StatementListSerializer; -use Wikibase\DataModel\Serializers\TermListSerializer; use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Statement\StatementList; use Wikibase\DataModel\Term\TermList; @@ -27,17 +26,13 @@ class ExternalLexemeSerializerTest extends PHPUnit_Framework_TestCase { private function newSerializer() { - $statementListSerializer = $this->getMockBuilder( StatementListSerializer::class ) - ->disableOriginalConstructor() - ->getMock(); + $statementListSerializer = $this->getMock( Serializer::class ); $statementListSerializer->method( 'serialize' ) ->will( $this->returnCallback( function ( StatementList $statementList ) { return implode( '|', $statementList->getPropertyIds() ); } ) ); - $termListSerializer = $this->getMockBuilder( TermListSerializer::class ) - ->disableOriginalConstructor() - ->getMock(); + $termListSerializer = $this->getMock( Serializer::class ); $termListSerializer->method( 'serialize' ) ->will( $this->returnCallback( function ( TermList $termList ) { return $termList->toTextArray(); diff --git a/tests/phpunit/composer/DataModel/Serialization/StorageLexemeSerializerTest.php b/tests/phpunit/composer/DataModel/Serialization/StorageLexemeSerializerTest.php index 1648362..2b48efe 100644 --- a/tests/phpunit/composer/DataModel/Serialization/StorageLexemeSerializerTest.php +++ b/tests/phpunit/composer/DataModel/Serialization/StorageLexemeSerializerTest.php @@ -13,7 +13,6 @@ use Wikibase\DataModel\Entity\EntityIdValue; use Wikibase\DataModel\Entity\ItemId; use Wikibase\Data
[MediaWiki-commits] [Gerrit] mediawiki...CentralAuth[master]: Replace deprecated wfSuppress- and wfRestoreWarnings functions
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405686 ) Change subject: Replace deprecated wfSuppress- and wfRestoreWarnings functions .. Replace deprecated wfSuppress- and wfRestoreWarnings functions Change-Id: I38b1cf6ada62f575ca625c69a4c4d6e7788f1067 --- M includes/specials/SpecialMergeAccount.php 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth refs/changes/86/405686/1 diff --git a/includes/specials/SpecialMergeAccount.php b/includes/specials/SpecialMergeAccount.php index 4b87a58..5033dfc 100644 --- a/includes/specials/SpecialMergeAccount.php +++ b/includes/specials/SpecialMergeAccount.php @@ -146,14 +146,14 @@ * @return array|mixed */ private function getWorkingPasswords() { - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $data = RequestContext::getMain()->getRequest()->getSessionData( 'wsCentralAuthMigration' ); $passwords = unserialize( gzinflate( $this->xorString( $data[$this->mSessionToken], $this->mSessionKey ) ) ); - wfRestoreWarnings(); + MediaWiki\suppressWarnings( true ); if ( is_array( $passwords ) ) { return $passwords; } -- To view, visit https://gerrit.wikimedia.org/r/405686 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I38b1cf6ada62f575ca625c69a4c4d6e7788f1067 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Set summary when editing form elements with the UI-dedicated...
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405316 ) Change subject: Set summary when editing form elements with the UI-dedicated API. .. Set summary when editing form elements with the UI-dedicated API. Bug: T184702 Change-Id: Iccb01836d871789be64c29c42d6edfff7ba0b0b1 --- A src/Api/AddGrammaticalFeatureSummary.php A src/Api/AddRepresentationSummary.php M src/Api/EditFormElements.php D src/Api/EditFormElementsSummary.php A src/Api/EditFormElementsSummaryFormatter.php A src/Api/RemoveGrammaticalFeatureSummary.php A src/Api/RemoveRepresentationSummary.php A src/Api/SetRepresentationSummary.php M src/ChangeOp/ChangeOpEditFormElements.php M tests/phpunit/mediawiki/Api/EditFormElementsTest.php 10 files changed, 632 insertions(+), 45 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/16/405316/1 diff --git a/src/Api/AddGrammaticalFeatureSummary.php b/src/Api/AddGrammaticalFeatureSummary.php new file mode 100644 index 000..884d1a5 --- /dev/null +++ b/src/Api/AddGrammaticalFeatureSummary.php @@ -0,0 +1,58 @@ +formId = $formId; + $this->addedFeatures = $addedFeatures; + } + + public function getUserSummary() { + return null; + } + + public function getLanguageCode() { + return null; + } + + public function getMessageKey() { + /** @see "wikibase-lexeme-summary-add-form-grammatical-feature" message */ + return 'add-form-grammatical-feature'; + } + + public function getCommentArgs() { + return array_merge( + [ $this->formId->getSerialization() ], + array_map( + function ( ItemId $feature ) { + return $feature->getSerialization(); + }, + $this->addedFeatures + ) + ); + } + + public function getAutoSummaryArgs() { + return []; + } + +} diff --git a/src/Api/AddRepresentationSummary.php b/src/Api/AddRepresentationSummary.php new file mode 100644 index 000..781b09c --- /dev/null +++ b/src/Api/AddRepresentationSummary.php @@ -0,0 +1,50 @@ +formId = $formId; + $this->addedRepresentation = $addedRepresentation; + } + + public function getUserSummary() { + return null; + } + + public function getLanguageCode() { + return $this->addedRepresentation->getLanguageCode(); // TODO: + } + + public function getMessageKey() { + /** @see "wikibase-lexeme-summary-add-form-representation" message */ + return 'add-form-representation'; + } + + public function getCommentArgs() { + return [ $this->formId->getSerialization() ]; + } + + public function getAutoSummaryArgs() { + return [ $this->addedRepresentation->getText() ]; + } + +} diff --git a/src/Api/EditFormElements.php b/src/Api/EditFormElements.php index 5eb2068..40866b1 100644 --- a/src/Api/EditFormElements.php +++ b/src/Api/EditFormElements.php @@ -7,6 +7,7 @@ use Wikibase\Lexeme\Api\Error\FormNotFound; use Wikibase\Lexeme\DataModel\Form; use Wikibase\Lexeme\DataModel\Serialization\FormSerializer; +use Wikibase\Lib\FormatableSummary; use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\Repo\WikibaseRepo; use Wikibase\SummaryFormatter; @@ -32,7 +33,7 @@ private $requestParser; /** -* @var SummaryFormatter +* @var EditFormElementsSummaryFormatter */ private $summaryFormatter; @@ -57,7 +58,7 @@ $wikibaseRepo->getEntityRevisionLookup( 'uncached' ), $wikibaseRepo->newEditEntityFactory( $mainModule->getContext() ), new EditFormElementsRequestParser( $wikibaseRepo->getEntityIdParser() ), - $wikibaseRepo->getSummaryFormatter(), + new EditFormElementsSummaryFormatter( $wikibaseRepo->getSummaryFormatter() ), $formSerializer ); } @@ -68,7 +69,7 @@ EntityRevisionLookup $entityRevisionLookup, EditEntityFactory $editEntityFactory, EditFormElementsRequestParser $requestParser, - SummaryFormatter $summaryFormatter, + EditFormElementsSummaryFormatter $summaryFormatter, FormSerializer $formSerializer ) { parent::__construct( $mainModule, $moduleName ); @@ -107,11 +108,12 @@ $form = $formRevision->getEntity();
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Update license to use "GPL-2.0-or-later"
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405315 ) Change subject: Update license to use "GPL-2.0-or-later" .. Update license to use "GPL-2.0-or-later" Packagist starts to complain about this. I know there is more (actually 2000+ mentions of "GPL-2.0+"), but let's start as trivial as possible. Change-Id: Id54646e51868bc1ee533dbc7ec08a4a4e275c019 --- M composer.json 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/15/405315/1 diff --git a/composer.json b/composer.json index 9816a07..ec40562 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "wikibaserepo" ], "homepage": "http://wikiba.se";, - "license": "GPL-2.0+", + "license": "GPL-2.0-or-later", "authors": [ { "name": "The Wikidata team" -- To view, visit https://gerrit.wikimedia.org/r/405315 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id54646e51868bc1ee533dbc7ec08a4a4e275c019 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Check “difference within range” on qualifiers and references
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405293 ) Change subject: Check “difference within range” on qualifiers and references .. Check “difference within range” on qualifiers and references To implement this, we can simply use Context::getSiblingSnaks(), since the semantics of that method are to ignore deprecated statements, just like DiffWithinRangeChecker also used to do. Unfortunately, a lot of changes in the tests are necessary: getSiblingSnaks() does not include the current snak, and in the case of MainSnakContext, this is achieved by removing statements with the same GUID – so all the test cases have to be adjusted to assign some GUID to the statements they create, otherwise too many statements are removed. Two new tests are also added, one for qualifiers and one for references. Bug: T175565 Change-Id: I21c4b0ec82baf461b38aca0022db3fbf70ebb651 --- M src/ConstraintCheck/Checker/DiffWithinRangeChecker.php M tests/phpunit/Checker/RangeChecker/DiffWithinRangeCheckerTest.php 2 files changed, 168 insertions(+), 57 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/93/405293/1 diff --git a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php index f516bbd..e7cd7d5 100644 --- a/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php +++ b/src/ConstraintCheck/Checker/DiffWithinRangeChecker.php @@ -67,9 +67,8 @@ public function getSupportedContextTypes() { return [ Context::TYPE_STATEMENT => CheckResult::STATUS_COMPLIANCE, - // TODO T175565 - Context::TYPE_QUALIFIER => CheckResult::STATUS_TODO, - Context::TYPE_REFERENCE => CheckResult::STATUS_TODO, + Context::TYPE_QUALIFIER => CheckResult::STATUS_COMPLIANCE, + Context::TYPE_REFERENCE => CheckResult::STATUS_COMPLIANCE, ]; } @@ -79,9 +78,8 @@ public function getDefaultContextTypes() { return [ Context::TYPE_STATEMENT, - // TODO T175565 - // Context::TYPE_QUALIFIER, - // Context::TYPE_REFERENCE, + Context::TYPE_QUALIFIER, + Context::TYPE_REFERENCE, ]; } @@ -162,19 +160,15 @@ list ( $min, $max, $property, $parameters ) = $this->parseConstraintParameters( $constraint ); // checks only the first occurrence of the referenced property (this constraint implies a single value constraint on that property) - /** @var Statement $otherStatement */ - foreach ( $context->getEntity()->getStatements() as $otherStatement ) { - $otherMainSnak = $otherStatement->getMainSnak(); - + foreach ( $context->getSiblingSnaks() as $otherSnak ) { if ( - !$property->equals( $otherStatement->getPropertyId() ) || - $otherStatement->getRank() === Statement::RANK_DEPRECATED || - !$otherMainSnak instanceof PropertyValueSnak + !$property->equals( $otherSnak->getPropertyId() ) || + !$otherSnak instanceof PropertyValueSnak ) { continue; } - $subtrahend = $otherMainSnak->getDataValue(); + $subtrahend = $otherSnak->getDataValue(); if ( $subtrahend->getType() === $minuend->getType() ) { $diff = $this->rangeInYears( $min, $max ) ? $this->rangeCheckerHelper->getDifferenceInYears( $minuend, $subtrahend ) : @@ -189,7 +183,7 @@ $message->rawParams( $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ), $this->constraintParameterRenderer->formatDataValue( $minuend, Role::OBJECT ), - $this->constraintParameterRenderer->formatEntityId( $otherStatement->getPropertyId(), Role::PREDICATE ), + $this->constraintParameterRenderer->formatEntityId( $otherSnak->getPropertyId(), Role::PREDICATE ), $this->constraintParameterRenderer->formatDataValue( $subtrahend, Role:
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Support qualifier and reference in value count checkers
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405282 ) Change subject: Support qualifier and reference in value count checkers .. Support qualifier and reference in value count checkers On the part of the checkers, this just means declaring support for the 'qualifier' and 'reference' context types – all the actual work is done by the getSiblingSnaks() implementations and the ValueCountCheckerHelper. For the tests, I added just one test for qualifiers and one for references (instead of having tests with one and two snaks for each context), since I think it’s unlikely that extra tests would uncover any more faults (both the getSiblingSnaks() implementations and ValueCountCheckerHelper already have more tests elsewhere). Change-Id: Id1ef2d371a479f9520c0b135abc0abc01169de09 --- M src/ConstraintCheck/Checker/MultiValueChecker.php M src/ConstraintCheck/Checker/SingleValueChecker.php M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php 4 files changed, 70 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/82/405282/1 diff --git a/src/ConstraintCheck/Checker/MultiValueChecker.php b/src/ConstraintCheck/Checker/MultiValueChecker.php index 7014060..c76301d 100644 --- a/src/ConstraintCheck/Checker/MultiValueChecker.php +++ b/src/ConstraintCheck/Checker/MultiValueChecker.php @@ -30,9 +30,8 @@ public function getSupportedContextTypes() { return [ Context::TYPE_STATEMENT => CheckResult::STATUS_COMPLIANCE, - // TODO T175566 - Context::TYPE_QUALIFIER => CheckResult::STATUS_TODO, - Context::TYPE_REFERENCE => CheckResult::STATUS_TODO, + Context::TYPE_QUALIFIER => CheckResult::STATUS_COMPLIANCE, + Context::TYPE_REFERENCE => CheckResult::STATUS_COMPLIANCE, ]; } diff --git a/src/ConstraintCheck/Checker/SingleValueChecker.php b/src/ConstraintCheck/Checker/SingleValueChecker.php index dcf26fc..0ad2661 100644 --- a/src/ConstraintCheck/Checker/SingleValueChecker.php +++ b/src/ConstraintCheck/Checker/SingleValueChecker.php @@ -30,9 +30,8 @@ public function getSupportedContextTypes() { return [ Context::TYPE_STATEMENT => CheckResult::STATUS_COMPLIANCE, - // TODO T175566 - Context::TYPE_QUALIFIER => CheckResult::STATUS_TODO, - Context::TYPE_REFERENCE => CheckResult::STATUS_TODO, + Context::TYPE_QUALIFIER => CheckResult::STATUS_COMPLIANCE, + Context::TYPE_REFERENCE => CheckResult::STATUS_COMPLIANCE, ]; } diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php index 962ddf7..cfdd52d 100644 --- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php @@ -2,11 +2,14 @@ namespace WikibaseQuality\ConstraintReport\Test\ValueCountChecker; +use Wikibase\DataModel\Reference; use Wikibase\Repo\Tests\NewItem; use Wikibase\Repo\Tests\NewStatement; use WikibaseQuality\ConstraintReport\Constraint; use WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\MultiValueChecker; use WikibaseQuality\ConstraintReport\ConstraintCheck\Context\MainSnakContext; +use WikibaseQuality\ConstraintReport\ConstraintCheck\Context\QualifierContext; +use WikibaseQuality\ConstraintReport\ConstraintCheck\Context\ReferenceContext; use WikibaseQuality\ConstraintReport\Tests\ResultAssertions; /** @@ -74,6 +77,36 @@ $this->assertViolation( $checkResult, 'wbqc-violation-message-multi-value' ); } + public function testMultiValueConstraint_One_Qualifier() { + $qualifier1 = NewStatement::noValueFor( 'P1' )->build()->getMainSnak(); + $qualifier2 = NewStatement::noValueFor( 'P2' )->build()->getMainSnak(); + $statement = NewStatement::someValueFor( 'P10' )->build(); + $statement->getQualifiers()->addSnak( $qualifier1 ); + $statement->getQualifiers()->addSnak( $qualifier2 ); + $item = NewItem::withStatement( $statement ) + ->andStatement( NewStatement::someValueFor( 'P1' ) ) + ->build(); + $context = new QualifierContext( $item, $statement, $qualifier1 ); + + $checkResult = $this->checker->
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Rewrite ValueCountCheckerHelper
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405033 ) Change subject: Rewrite ValueCountCheckerHelper .. Rewrite ValueCountCheckerHelper ValueCountCheckerHelper now receives a Snak[] instead of a StatementList, and also receives the property ID to look for instead of returning an array of the counts of all properties. SingleValueChecker and MultiValueChecker are adjusted accordingly and pass the sibling snaks of the context into ValueCountCheckerHelper. This does not yet provide proper support for checking those constraints on qualifiers and references, since the checkers declare to not support those types yet. getSupportedContextTypes will be adjusted in a separate commit which will also add tests for checking these constraints on qualifiers and references. Bug: T175566 Change-Id: I301400edd29b0a10ffc131fd5a20bf6e3b193852 --- M src/ConstraintCheck/Checker/MultiValueChecker.php M src/ConstraintCheck/Checker/SingleValueChecker.php M src/ConstraintCheck/Helper/ValueCountCheckerHelper.php M tests/phpunit/Checker/ValueCountChecker/ValueCountCheckerHelperTest.php 4 files changed, 44 insertions(+), 50 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/33/405033/1 diff --git a/src/ConstraintCheck/Checker/MultiValueChecker.php b/src/ConstraintCheck/Checker/MultiValueChecker.php index 6f200d4..7014060 100644 --- a/src/ConstraintCheck/Checker/MultiValueChecker.php +++ b/src/ConstraintCheck/Checker/MultiValueChecker.php @@ -64,9 +64,12 @@ $parameters = []; - $propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount( $context->getEntity()->getStatements() ); + $propertyCount = $this->valueCountCheckerHelper->getPropertyCount( + $context->getSiblingSnaks(), + $propertyId + ) + 1; // the sibling snaks do not include the context’s own snak - if ( $propertyCountArray[$propertyId->getSerialization()] <= 1 ) { + if ( $propertyCount <= 1 ) { $message = wfMessage( "wbqc-violation-message-multi-value" )->escaped(); $status = CheckResult::STATUS_VIOLATION; } else { diff --git a/src/ConstraintCheck/Checker/SingleValueChecker.php b/src/ConstraintCheck/Checker/SingleValueChecker.php index 5218b78..dcf26fc 100644 --- a/src/ConstraintCheck/Checker/SingleValueChecker.php +++ b/src/ConstraintCheck/Checker/SingleValueChecker.php @@ -64,9 +64,12 @@ $parameters = []; - $propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount( $context->getEntity()->getStatements() ); + $propertyCount = $this->valueCountCheckerHelper->getPropertyCount( + $context->getSiblingSnaks(), + $propertyId + ) + 1; // the sibling snaks do not include the context’s own snak - if ( $propertyCountArray[$propertyId->getSerialization()] > 1 ) { + if ( $propertyCount > 1 ) { $message = wfMessage( "wbqc-violation-message-single-value" )->escaped(); $status = CheckResult::STATUS_VIOLATION; } else { diff --git a/src/ConstraintCheck/Helper/ValueCountCheckerHelper.php b/src/ConstraintCheck/Helper/ValueCountCheckerHelper.php index 849e770..f9b675c 100644 --- a/src/ConstraintCheck/Helper/ValueCountCheckerHelper.php +++ b/src/ConstraintCheck/Helper/ValueCountCheckerHelper.php @@ -2,43 +2,31 @@ namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Helper; -use Wikibase\DataModel\Statement\Statement; -use Wikibase\DataModel\Statement\StatementList; +use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Snak\Snak; /** * Class for helper functions for value count checkers. * - * @author BP2014N1 + * @author Lucas Werkmeister * @license GNU GPL v2+ */ class ValueCountCheckerHelper { /** -* @var int[] -*/ - private $propertyCount; - - /** -* @param StatementList $statements +* Count the number of snaks with the given property ID. * -* @return int[] +* @param Snak[] $snaks +* @param PropertyId $propertyId +* @return int */ - public function getPropertyCount( StatementList $statements ) { - if ( !isset( $this->propertyCount ) ) { - $this->propertyCount = []; - - /** @var Statement $statement */ - foreach ( $statements as $statement ) { - $counter = $statement->getRank() === Statement::RANK_DEPRECATED ? 0 : 1; -
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Rewrite ValueCountChecker tests
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/405032 ) Change subject: Rewrite ValueCountChecker tests .. Rewrite ValueCountChecker tests The tests for SingleValueChecker and MultiValueChecker used to load entities from JSON files and then additionally construct the Statement for the context independently of them, which was risky because the constructed Statement was not entirely equivalent to the deserialized one (its GUID was never set). Since this pattern breaks with the upcoming changes to ValueCountCheckerHelper (change TODO, for T175566), rewrite the tests to use NewItem and NewStatement instead. And on that opportunity, also do some other cleanups: most importantly, create the mock Constraint object in the constructor, since we never passed anything other than [] into the constraint parameters anyways (and there was also a typo on the mocked method name – the real method name is getConstraintParameters, plural), and also skip the mocking of methods (never called anyways). Note: Q1.json and Q6.json are used by UniqueValueCheckerTest and therefore can’t be deleted yet. Bug: T168240 Change-Id: I0fced666d5e49d7c7cada49eab19bff972214c9b --- M tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php D tests/phpunit/Checker/ValueCountChecker/Q2.json D tests/phpunit/Checker/ValueCountChecker/Q3.json D tests/phpunit/Checker/ValueCountChecker/Q4.json D tests/phpunit/Checker/ValueCountChecker/Q5.json M tests/phpunit/Checker/ValueCountChecker/SingleValueCheckerTest.php 6 files changed, 64 insertions(+), 326 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/32/405032/1 diff --git a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php index ea18498..ea41c31 100644 --- a/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php +++ b/tests/phpunit/Checker/ValueCountChecker/MultiValueCheckerTest.php @@ -20,7 +20,7 @@ * * @group WikibaseQualityConstraints * - * @author BP2014N1 + * @author Lucas Werkmeister * @license GNU GPL v2+ */ class MultiValueCheckerTest extends \MediaWikiTestCase { @@ -28,97 +28,75 @@ use ResultAssertions; /** -* @var PropertyId +* @var Constraint */ - private $multiPropertyId; + private $constraint; /** * @var MultiValueChecker */ private $checker; - /** -* @var JsonFileEntityLookup -*/ - private $lookup; - protected function setUp() { parent::setUp(); - $this->multiPropertyId = new PropertyId( 'P161' ); + $this->constraint = $this->getMockBuilder( Constraint::class ) + ->disableOriginalConstructor() + ->getMock(); $this->checker = new MultiValueChecker(); - $this->lookup = new JsonFileEntityLookup( __DIR__ ); } - public function testMultiValueConstraintOne() { - $entity = $this->lookup->getEntity( new ItemId( 'Q4' ) ); - $statement = new Statement( new PropertyValueSnak( $this->multiPropertyId, new EntityIdValue( new ItemId( 'Q207' ) ) ) ); - $constraint = $this->getConstraintMock( [] ); + public function testMultiValueConstraint_One() { + $statement = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $item = NewItem::withStatement( $statement )->build(); + $context = new MainSnakContext( $item, $statement ); - $checkResult = $this->checker->checkConstraint( new MainSnakContext( $entity, $statement ), $constraint ); + $checkResult = $this->checker->checkConstraint( $context, $this->constraint ); $this->assertViolation( $checkResult, 'wbqc-violation-message-multi-value' ); } - public function testMultiValueConstraintTwo() { - $entity = $this->lookup->getEntity( new ItemId( 'Q5' ) ); - $statement = new Statement( new PropertyValueSnak( $this->multiPropertyId, new EntityIdValue( new ItemId( 'Q207' ) ) ) ); - $constraint = $this->getConstraintMock( [] ); + public function testMultiValueConstraint_Two() { + $statement1 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $statement2 = NewStatement::noValueFor( 'P1' )->withSomeGuid()->build(); + $item = NewItem::withStatement( $statement1 )->andStatement( $statement2 )->build(); + $context = new MainSnakContext( $ite
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add Context::getSiblingSnaks method
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404994 ) Change subject: Add Context::getSiblingSnaks method .. Add Context::getSiblingSnaks method The “sibling snaks” concept could be used by several checkers, but for now, we will start with the “single value” and “multiple values” checkers. This is also why we copy the ValueCountCheckerHelper semantics of ignoring deprecated statements in MainSnakContext (though we might make this configurable with a method parameter later). Bug: T185209 Change-Id: I6b926bfe4791b2351c16143b478e06980f03b8f7 --- M src/ConstraintCheck/Context/Context.php M src/ConstraintCheck/Context/MainSnakContext.php M src/ConstraintCheck/Context/QualifierContext.php M src/ConstraintCheck/Context/ReferenceContext.php M tests/phpunit/Context/MainSnakContextTest.php M tests/phpunit/Context/QualifierContextTest.php M tests/phpunit/Context/ReferenceContextTest.php M tests/phpunit/Fake/FakeSnakContext.php 8 files changed, 108 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/94/404994/1 diff --git a/src/ConstraintCheck/Context/Context.php b/src/ConstraintCheck/Context/Context.php index 07d590b..82c0d37 100644 --- a/src/ConstraintCheck/Context/Context.php +++ b/src/ConstraintCheck/Context/Context.php @@ -75,6 +75,17 @@ public function getSnakStatement(); /** +* The other snaks in the list of snaks that the snak being checked resides in. +* For a statement context, this is the main snaks of other (non-deprecated) statements; +* for a qualifier context, the other qualifiers of the same statement; +* and for a reference context, the other snaks of the same reference. +* +* @return Snak[] not a SnakList because for a statement context, +* the returned value might contain the same snak several times. +*/ + public function getSiblingSnaks(); + + /** * Store the check result serialization $result * at the appropriate location for this context in $container. * diff --git a/src/ConstraintCheck/Context/MainSnakContext.php b/src/ConstraintCheck/Context/MainSnakContext.php index 2970753..fb14a4d 100644 --- a/src/ConstraintCheck/Context/MainSnakContext.php +++ b/src/ConstraintCheck/Context/MainSnakContext.php @@ -4,6 +4,8 @@ use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Statement\Statement; +use Wikibase\DataModel\Statement\StatementList; +use Wikibase\DataModel\Statement\StatementListProvider; /** * A constraint check context for the main snak of a statement. @@ -41,6 +43,15 @@ return $this->statement; } + public function getSiblingSnaks() { + /** @var StatementList $statements */ + $statements = clone $this->entity->getStatements(); + $statements->removeStatementsWithGuid( $this->statement->getGuid() ); + return $statements + ->getByRank( [ Statement::RANK_NORMAL, Statement::RANK_PREFERRED ] ) + ->getMainSnaks(); + } + protected function &getMainArray( array &$container ) { $statementArray = &$this->getStatementArray( $container, diff --git a/src/ConstraintCheck/Context/QualifierContext.php b/src/ConstraintCheck/Context/QualifierContext.php index 3f8fc0b..4bb66e6 100644 --- a/src/ConstraintCheck/Context/QualifierContext.php +++ b/src/ConstraintCheck/Context/QualifierContext.php @@ -31,6 +31,12 @@ return self::TYPE_QUALIFIER; } + public function getSiblingSnaks() { + $snaks = clone $this->statement->getQualifiers(); + $snaks->removeSnak( $this->snak ); + return array_values( $snaks->getArrayCopy() ); + } + protected function &getMainArray( array &$container ) { $statementArray = &$this->getStatementArray( $container, diff --git a/src/ConstraintCheck/Context/ReferenceContext.php b/src/ConstraintCheck/Context/ReferenceContext.php index d0ba238..f83cc17 100644 --- a/src/ConstraintCheck/Context/ReferenceContext.php +++ b/src/ConstraintCheck/Context/ReferenceContext.php @@ -39,6 +39,12 @@ return self::TYPE_REFERENCE; } + public function getSiblingSnaks() { + $snaks = clone $this->reference->getSnaks(); + $snaks->removeSnak( $this->snak ); + return array_values( $snaks->getArrayCopy() ); + } + protected function &getMainArray( array &$container ) { $statementArray = &$this->getStatementArray( $container, diff --g
[MediaWiki-commits] [Gerrit] mediawiki...CirrusSearch[master]: When running Selenium tests, use `wd/hub`
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404985 ) Change subject: When running Selenium tests, use `wd/hub` .. When running Selenium tests, use `wd/hub` Now it works on Mac, Windows and Linux. Change-Id: I2a28db4e5a0a203c245d4987499e611a399fabdc --- M tests/selenium/README.md 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch refs/changes/85/404985/1 diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 3480b63..94b31b9 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -8,7 +8,7 @@ In one terminal window or tab start Chromedriver: -chromedriver --url-base=/wd/hub --port= +chromedriver --url-base=wd/hub --port= In another terminal tab or window go to mediawiki/core folder: -- To view, visit https://gerrit.wikimedia.org/r/404985 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a28db4e5a0a203c245d4987499e611a399fabdc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Echo[master]: When running Selenium tests, use `wd/hub`
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404983 ) Change subject: When running Selenium tests, use `wd/hub` .. When running Selenium tests, use `wd/hub` Now it works on Mac, Windows and Linux. Change-Id: Idf984c89f541a44ad522ff4d765dc58ada407797 --- M tests/selenium/README.md 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo refs/changes/83/404983/1 diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 3c6c9a4..4d02900 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -17,7 +17,7 @@ To run only Echo tests in one terminal window or tab start Chromedriver: -chromedriver --url-base=/wd/hub --port= +chromedriver --url-base=wd/hub --port= In another terminal tab or window go to mediawiki/core folder: -- To view, visit https://gerrit.wikimedia.org/r/404983 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idf984c89f541a44ad522ff4d765dc58ada407797 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Popups[master]: When running Selenium tests, use `wd/hub`
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404982 ) Change subject: When running Selenium tests, use `wd/hub` .. When running Selenium tests, use `wd/hub` Now it works on Mac, Windows and Linux. Change-Id: I6ac70e02bc634bb559426baa29dd22f710e554a1 --- M tests/selenium/README.md 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups refs/changes/82/404982/1 diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 76a7175..4d93e42 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -21,7 +21,7 @@ To run only Popups tests in one terminal window or tab start Chromedriver: -chromedriver --url-base=/wd/hub --port= +chromedriver --url-base=wd/hub --port= In another terminal tab or window go to mediawiki/core folder: -- To view, visit https://gerrit.wikimedia.org/r/404982 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ac70e02bc634bb559426baa29dd22f710e554a1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Popups Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...ElectronPdfService[master]: When running Selenium tests, use `wd/hub`
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404981 ) Change subject: When running Selenium tests, use `wd/hub` .. When running Selenium tests, use `wd/hub` Now it works on Mac, Windows and Linux. Change-Id: I010ca5e9ae1fa72d80ffec63761461ac0da70d10 --- M tests/selenium/README.md 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ElectronPdfService refs/changes/81/404981/1 diff --git a/tests/selenium/README.md b/tests/selenium/README.md index a877942..caacc86 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -17,7 +17,7 @@ To run only ElectronPdfService tests in one terminal window or tab start Chromedriver: -chromedriver --url-base=/wd/hub --port= +chromedriver --url-base=wd/hub --port= In another terminal tab or window go to mediawiki/core folder: -- To view, visit https://gerrit.wikimedia.org/r/404981 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I010ca5e9ae1fa72d80ffec63761461ac0da70d10 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ElectronPdfService Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQuality[master]: Use Wikimedia\Assert and type hints
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404975 ) Change subject: Use Wikimedia\Assert and type hints .. Use Wikimedia\Assert and type hints This reduces the verbosity of some error handling code, and since parts of that error handling code were untested, also increases test coverage. Change-Id: Idc984d31e27d61bc625663c9db1c1a804fe385ef --- M includes/Html/HtmlTableBuilder.php M includes/Html/HtmlTableCellBuilder.php M includes/Html/HtmlTableHeaderBuilder.php M tests/phpunit/Html/HtmlTableBuilderTest.php M tests/phpunit/Html/HtmlTableCellBuilderTest.php M tests/phpunit/Html/HtmlTableHeaderBuilderTest.php 6 files changed, 24 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQuality refs/changes/75/404975/1 diff --git a/includes/Html/HtmlTableBuilder.php b/includes/Html/HtmlTableBuilder.php index 6bb7a0d..8a9a98e 100644 --- a/includes/Html/HtmlTableBuilder.php +++ b/includes/Html/HtmlTableBuilder.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Html; +use Wikimedia\Assert\Assert; /** * @package WikibaseQuality\Html @@ -31,16 +32,8 @@ /** * @param array $headers -* -* @throws InvalidArgumentException */ - public function __construct( $headers ) { - if ( !is_array( $headers ) ) { - throw new InvalidArgumentException( - '$headers must be an array of strings or HtmlTableHeader elements.' - ); - } - + public function __construct( array $headers ) { foreach ( $headers as $header ) { $this->addHeader( $header ); } @@ -52,14 +45,10 @@ * @throws InvalidArgumentException */ private function addHeader( $header ) { + Assert::parameterType( 'string|\WikibaseQuality\Html\HtmlTableHeaderBuilder', $header, '$header' ); + if ( is_string( $header ) ) { $header = new HtmlTableHeaderBuilder( $header ); - } - - if ( !( $header instanceof HtmlTableHeaderBuilder ) ) { - throw new InvalidArgumentException( - 'Each element in $headers must be a string or an HtmlTableHeader' - ); } $this->headers[] = $header; diff --git a/includes/Html/HtmlTableCellBuilder.php b/includes/Html/HtmlTableCellBuilder.php index d49a056..691c39d 100644 --- a/includes/Html/HtmlTableCellBuilder.php +++ b/includes/Html/HtmlTableCellBuilder.php @@ -2,8 +2,9 @@ namespace WikibaseQuality\Html; -use InvalidArgumentException; use Html; +use Wikimedia\Assert\Assert; +use Wikimedia\Assert\ParameterTypeException; /** * @package WikibaseQuality\Html @@ -36,16 +37,11 @@ * @param array $attributes * @param bool $isRawContent * -* @throws InvalidArgumentException +* @throws ParameterTypeException */ public function __construct( $content, array $attributes = [], $isRawContent = false ) { - // Check parameters - if ( !is_string( $content ) ) { - throw new InvalidArgumentException( '$content must be string.' ); - } - if ( !is_bool( $isRawContent ) ) { - throw new InvalidArgumentException( '$isRawContent must be boolean.' ); - } + Assert::parameterType( 'string', $content, '$content' ); + Assert::parameterType( 'boolean', $isRawContent, '$isRawContent' ); $this->content = $content; $this->attributes = $attributes; diff --git a/includes/Html/HtmlTableHeaderBuilder.php b/includes/Html/HtmlTableHeaderBuilder.php index c1e03ed..15c906c 100644 --- a/includes/Html/HtmlTableHeaderBuilder.php +++ b/includes/Html/HtmlTableHeaderBuilder.php @@ -2,8 +2,9 @@ namespace WikibaseQuality\Html; -use InvalidArgumentException; use Html; +use Wikimedia\Assert\Assert; +use Wikimedia\Assert\ParameterTypeException; /** * @package WikibaseQuality\Html @@ -38,18 +39,12 @@ * @param bool $isSortable * @param bool $isRawContent * -* @throws InvalidArgumentException +* @throws ParameterTypeException */ public function __construct( $content, $isSortable = false, $isRawContent = false ) { - if ( !is_string( $content ) ) { - throw new InvalidArgumentException( '$content must be string.' ); - } - if ( !is_bool( $isSortable ) ) { - throw new I
[MediaWiki-commits] [Gerrit] mediawiki/vendor[master]: Add missing files from Wikibase Data Model Services 3.9.0
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404727 ) Change subject: Add missing files from Wikibase Data Model Services 3.9.0 .. Add missing files from Wikibase Data Model Services 3.9.0 Somehow I85599848655088347e5b006d12e51f2bc1cd7ffb missed those files, although autoload list include them. Change-Id: I3479fc2e76c5ee54cefd30bb9d40a6c8a90e0b1a --- A wikibase/data-model-services/COPYING A wikibase/data-model-services/src/EntityId/EntityIdComposer.php A wikibase/data-model-services/src/Lookup/DisabledEntityTypesEntityLookup.php 3 files changed, 490 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor refs/changes/27/404727/1 diff --git a/wikibase/data-model-services/COPYING b/wikibase/data-model-services/COPYING new file mode 100644 index 000..7d2552f --- /dev/null +++ b/wikibase/data-model-services/COPYING @@ -0,0 +1,347 @@ +The license text below "" applies to all files within this distribution, other +than those that are in a directory which contains files named "LICENSE" or +"COPYING", or a subdirectory thereof. For those files, the license text contained in +said file overrides any license information contained in directories of smaller depth. +Alternative licenses are typically used for software that is provided by external +parties, and merely packaged with the Wikibase release for convenience. + + +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + +GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +tha
[MediaWiki-commits] [Gerrit] mediawiki...RevisionSlider[master]: Update eslint and stylelint
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404720 ) Change subject: Update eslint and stylelint .. Update eslint and stylelint Change-Id: I6c316a927427b7ab5f4f47ae5e35bddf5deac419 --- M package.json 1 file changed, 3 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RevisionSlider refs/changes/20/404720/1 diff --git a/package.json b/package.json index 24cb748..a4a2911 100644 --- a/package.json +++ b/package.json @@ -11,12 +11,13 @@ "test": "grunt test" }, "devDependencies": { + "eslint": "4.9.0", "eslint-config-wikimedia": "0.5.0", "grunt": "1.0.1", "grunt-banana-checker": "0.6.0", - "grunt-eslint": "20.0.0", + "grunt-eslint": "20.1.0", "grunt-jsonlint": "1.1.0", - "grunt-stylelint": "0.8.0", + "grunt-stylelint": "0.9.0", "stylelint": "8.2.0", "stylelint-config-wikimedia": "0.4.2" } -- To view, visit https://gerrit.wikimedia.org/r/404720 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6c316a927427b7ab5f4f47ae5e35bddf5deac419 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/RevisionSlider Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...AdvancedSearch[master]: Update eslint and stylelint
WMDE-Fisch has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404719 ) Change subject: Update eslint and stylelint .. Update eslint and stylelint Change-Id: I650eb43d7f44ab8beead11eaf66911d40b4e094d --- M modules/ext.advancedSearch.css M modules/ext.advancedSearch.init.css M modules/ui/ext.advancedSearch.TemplateSearch.js M package.json 4 files changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AdvancedSearch refs/changes/19/404719/1 diff --git a/modules/ext.advancedSearch.css b/modules/ext.advancedSearch.css index d3f4a41..0d91f45 100644 --- a/modules/ext.advancedSearch.css +++ b/modules/ext.advancedSearch.css @@ -124,7 +124,7 @@ .mw-advancedSearch-namespace-selection { border-radius: 2px; border: solid 1px #a2a9b1; - background: rgb( 248, 249, 250 ); + background: #f8f9fa; box-sizing: border-box; margin-top: 0.3em; max-width: 50em; diff --git a/modules/ext.advancedSearch.init.css b/modules/ext.advancedSearch.init.css index df8c477..f007eda 100644 --- a/modules/ext.advancedSearch.init.css +++ b/modules/ext.advancedSearch.init.css @@ -1,4 +1,4 @@ -/* stylelint-disable-next-line selector-no-id */ +/* stylelint-disable-next-line selector-max-id */ .client-js #mw-searchoptions, .client-js .mw-search-profile-tabs { display: none; diff --git a/modules/ui/ext.advancedSearch.TemplateSearch.js b/modules/ui/ext.advancedSearch.TemplateSearch.js index 07cdd32..93580d6 100644 --- a/modules/ui/ext.advancedSearch.TemplateSearch.js +++ b/modules/ui/ext.advancedSearch.TemplateSearch.js @@ -147,7 +147,7 @@ /** * Implemented because OO.ui.mixin.LookupElement expects it. * -* @returns {boolean} +* @return {boolean} */ mw.libs.advancedSearch.ui.TemplateSearch.prototype.isReadOnly = function () { return false; diff --git a/package.json b/package.json index 8d0d533..7ecdc13 100644 --- a/package.json +++ b/package.json @@ -4,15 +4,16 @@ "test": "grunt test" }, "devDependencies": { - "eslint": "3.12.2", - "eslint-config-wikimedia": "0.4.0", + "eslint": "4.9.0", + "eslint-config-wikimedia": "0.5.0", "grunt": "1.0.1", "grunt-banana-checker": "0.6.0", - "grunt-eslint": "20.0.0", + "grunt-eslint": "20.1.0", "grunt-jsonlint": "1.1.0", - "grunt-stylelint": "0.7.0", + "grunt-stylelint": "0.9.0", "qunitjs": "^2.4.0", "sinon": "^1.17.3", - "stylelint-config-wikimedia": "0.4.1" + "stylelint": "8.2.0", + "stylelint-config-wikimedia": "0.4.2" } } -- To view, visit https://gerrit.wikimedia.org/r/404719 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I650eb43d7f44ab8beead11eaf66911d40b4e094d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/AdvancedSearch Gerrit-Branch: master Gerrit-Owner: WMDE-Fisch ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Fix test class name
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404714 ) Change subject: Fix test class name .. Fix test class name Change-Id: I5d3a31a7c4894f42b16a01e70739b16a0f776892 --- M tests/phpunit/Job/UpdateConstraintsTableJobTest.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/14/404714/1 diff --git a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php index a13b551..054d3c3 100644 --- a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php +++ b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php @@ -34,7 +34,7 @@ * @author Lucas Werkmeister * @license GNU GPL v2+ */ -class UpdateConstraintsTableTest extends MediaWikiTestCase { +class UpdateConstraintsTableJobTest extends MediaWikiTestCase { use DefaultConfig; -- To view, visit https://gerrit.wikimedia.org/r/404714 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5d3a31a7c4894f42b16a01e70739b16a0f776892 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Use InMemoryEntityLookup instead of JsonFileEntityLookup
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404715 ) Change subject: Use InMemoryEntityLookup instead of JsonFileEntityLookup .. Use InMemoryEntityLookup instead of JsonFileEntityLookup Bug: T168240 Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1 --- D tests/phpunit/Job/P2.json M tests/phpunit/Job/UpdateConstraintsTableJobTest.php 2 files changed, 18 insertions(+), 36 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/15/404715/1 diff --git a/tests/phpunit/Job/P2.json b/tests/phpunit/Job/P2.json deleted file mode 100644 index 22ee7e0..000 --- a/tests/phpunit/Job/P2.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": "P2", - "type": "property", - "datatype": "wikibase-item", - "aliases": {}, - "labels": { -"en": { - "language": "en", - "value": "my property" -} - }, - "claims": { -"P2302": [ - { -"id": "P2$484b7eaf-e86c-4f25-91dc-7ae19f8be8de", -"mainsnak": { - "snaktype": "value", - "property": "P2302", - "datatype": "wikibase-item", - "datavalue": { -"value": { - "entity-type": "item", - "numeric-id": 19474404, - "id": "Q19474404" -}, -"type": "wikibase-entityid" - } -}, -"type": "statement", -"rank": "normal" - } -] - } -} diff --git a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php index 054d3c3..2ad3a3d 100644 --- a/tests/phpunit/Job/UpdateConstraintsTableJobTest.php +++ b/tests/phpunit/Job/UpdateConstraintsTableJobTest.php @@ -21,7 +21,6 @@ use WikibaseQuality\ConstraintReport\ConstraintRepository; use WikibaseQuality\ConstraintReport\Tests\DefaultConfig; use WikibaseQuality\ConstraintReport\UpdateConstraintsTableJob; -use WikibaseQuality\Tests\Helper\JsonFileEntityLookup; use Wikibase\Repo\WikibaseRepo; /** @@ -312,13 +311,30 @@ } public function testRun() { + $config = $this->getDefaultConfig(); + $propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); + $singleValueConstraintId = $config->get( 'WBQualityConstraintsSingleValueConstraintId' ); + $property = new Property( + new PropertyId( 'P2' ), + null, + 'wikibase-item', + new StatementList( + NewStatement::forProperty( $propertyConstraintId ) + ->withValue( new ItemId( $singleValueConstraintId ) ) + ->withGuid( 'P2$484b7eaf-e86c-4f25-91dc-7ae19f8be8de' ) + ->build() + ) + ); + $entityLookup = new InMemoryEntityLookup(); + $entityLookup->addEntity( $property ); + $job = new UpdateConstraintsTableJob( Title::newFromText( 'constraintsTableUpdate' ), [], 'P2', $this->getDefaultConfig(), new ConstraintRepository(), - new JsonFileEntityLookup( __DIR__ ), + $entityLookup, WikibaseRepo::getDefaultInstance()->getBaseDataModelSerializerFactory()->newSnakSerializer() ); -- To view, visit https://gerrit.wikimedia.org/r/404715 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I649302db640f3ba55d013d5391b6048e1647e3d1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add support for parsing “instance or subclass of” relation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404710 ) Change subject: Add support for parsing “instance or subclass of” relation .. Add support for parsing “instance or subclass of” relation “instance or subclass of” is a new value for the “relation” parameter, in addition to the existing “instance of” and “subclass of” values. A new config variable is added for the item ID of the “instance or subclass of” relation item, ConstraintParameterParser learns to parse it (returning the string “relationOrSubclass” – without spaces, since it will be used in an i18n message key), and the ConstraintParameters test trait learns to produce the parameter from that string. Bug: T169858 Change-Id: I0d2a663e5f2200e71640942dab1d21d92eb9d5f7 --- M extension.json M src/ConstraintCheck/Helper/ConstraintParameterParser.php M tests/phpunit/ConstraintParameters.php 3 files changed, 18 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/10/404710/1 diff --git a/extension.json b/extension.json index 212c6e3..bc3d7c8 100644 --- a/extension.json +++ b/extension.json @@ -334,6 +334,11 @@ "description": "The item ID of the 'subclass of' item, which, when used in a 'relation' qualifier of a 'property constraint' statement on a property, indicates that the 'type' or 'value type' constraint defined in this statement demands a 'subclass' relation.", "public": true }, + "WBQualityConstraintsInstanceOrSubclassOfRelationId": { + "value": "Q30208840", + "description": "The item ID of the 'instance or subclass of' item, which, when used in a 'relation' qualifier of a 'property constraint' statement on a property, indicates that the 'type' or 'value type' constraint defined in this statement demands a 'instance or subclass' relation.", + "public": true + }, "WBQualityConstraintsPropertyId": { "value": "P2306", "description": "The property ID of the 'property' property (data type: property), which specifies the property parameter of an 'inverse', 'item requires claim', 'value requires claim', 'difference within range', 'mandatory qualifiers', or 'qualifiers' constraint.", diff --git a/src/ConstraintCheck/Helper/ConstraintParameterParser.php b/src/ConstraintCheck/Helper/ConstraintParameterParser.php index d9750e3..e760668 100644 --- a/src/ConstraintCheck/Helper/ConstraintParameterParser.php +++ b/src/ConstraintCheck/Helper/ConstraintParameterParser.php @@ -176,7 +176,7 @@ * @param array $constraintParameters see {@link \WikibaseQuality\Constraint::getConstraintParameters()} * @param string $constraintTypeItemId used in error messages * @throws ConstraintParameterException if the parameter is invalid or missing -* @return string 'instance' or 'subclass' +* @return string 'instance', 'subclass', or 'instanceOrSubclass' */ public function parseRelationParameter( array $constraintParameters, $constraintTypeItemId ) { $this->checkError( $constraintParameters ); @@ -194,17 +194,23 @@ $relationEntityId = $this->parseEntityIdParameter( $constraintParameters[$relationId][0], $relationId ); $instanceId = $this->config->get( 'WBQualityConstraintsInstanceOfRelationId' ); $subclassId = $this->config->get( 'WBQualityConstraintsSubclassOfRelationId' ); + $instanceOrSubclassId = $this->config->get( 'WBQualityConstraintsInstanceOrSubclassOfRelationId' ); switch ( $relationEntityId ) { case $instanceId: return 'instance'; case $subclassId: return 'subclass'; + case $instanceOrSubclassId: + return 'instanceOrSubclass'; default: throw new ConstraintParameterException( wfMessage( 'wbqc-violation-message-parameter-oneof' ) ->rawParams( $this->constraintParameterRenderer->formatPropertyId(
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Remove unused message
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404708 ) Change subject: Remove unused message .. Remove unused message The wbqc-violation-message-type-relation-instance-or-subclass message has been unused since commit 8bd6518a9c (change I7e98ff5d74) removed support for constraint parameters imported from constraint templates, and with T169858 it is about to become inaccurate as well. (If constraint parameters from a constraint statement specify an invalid value for the “relation” parameter, the more generic wbqc-violation-message-parameter-oneof message is used instead.) Bug: T169858 Change-Id: I92c1d469ab5aa2c909078e4790cb6b5b18bdbf4e --- M i18n/en.json M i18n/qqq.json 2 files changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/08/404708/1 diff --git a/i18n/en.json b/i18n/en.json index f10ed45..2327d3e 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -134,7 +134,6 @@ "wbqc-violation-message-range-time-rightopen": "The value for $1 ($2) should not be before $3.", "wbqc-violation-message-single-value": "This property should only contain a single value. That is, there should only be one statement using this property.", "wbqc-violation-message-symmetric": "$1 should also have the symmetric statement $2 $3.", - "wbqc-violation-message-type-relation-instance-or-subclass": "Parameter \"relation\" must be either \"instance\" or \"subclass\".", "wbqc-violation-message-type-instance": "Entities using the $1 property should be instances of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-type-subclass": "Entities using the $1 property should be subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-valueType-instance": "Values of $1 statements should be instances of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", diff --git a/i18n/qqq.json b/i18n/qqq.json index 03b0081..8c4484d 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -132,7 +132,6 @@ "wbqc-violation-message-range-time-rightopen": "Message for a violation of the “Range” constraint, when the value of a statement is earlier than allowed (for a time range with a lower but no upper limit). Parameters:\n* $1 is the property of the statement.\n* $2 is the value of the statement.\n* $3 is the lower bound of the range (inclusive).\n{{Related|wbqc-violation-message-range-time-closed}}\n{{Related|wbqc-violation-message-range-quantity-rightopen}}", "wbqc-violation-message-single-value": "Message for violation of Single value constraint. When more than one value exists.", "wbqc-violation-message-symmetric": "Message for a violation of the “Symmetric” constraint, when the symmetric statement of a statement does not exist. $1, $2 and $3 contain the expected subject entity, property, and target entity of the missing symmetric statement.", - "wbqc-violation-message-type-relation-instance-or-subclass": "Message for violation of Type/Value type constraint. When relation is neither instance nor subclass.", "wbqc-violation-message-type-instance": "Message for a violation of the “Type” constraint, when the subject of a statement should have be an instance of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-subclass}}", "wbqc-violation-message-type-subclass": "Message for a violation of the “Type” constraint, when the subject of a statement should have be a subclass of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-instance}}", "wbqc-violation-message-valueType-ins
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Fix message documentation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404709 ) Change subject: Fix message documentation .. Fix message documentation “should have be” is not correct English. Change-Id: Id3f987623ca0cf6c7af3b4c05564d4800a362d30 --- M i18n/qqq.json 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/09/404709/1 diff --git a/i18n/qqq.json b/i18n/qqq.json index 8c4484d..0fa388a 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -132,10 +132,10 @@ "wbqc-violation-message-range-time-rightopen": "Message for a violation of the “Range” constraint, when the value of a statement is earlier than allowed (for a time range with a lower but no upper limit). Parameters:\n* $1 is the property of the statement.\n* $2 is the value of the statement.\n* $3 is the lower bound of the range (inclusive).\n{{Related|wbqc-violation-message-range-time-closed}}\n{{Related|wbqc-violation-message-range-quantity-rightopen}}", "wbqc-violation-message-single-value": "Message for violation of Single value constraint. When more than one value exists.", "wbqc-violation-message-symmetric": "Message for a violation of the “Symmetric” constraint, when the symmetric statement of a statement does not exist. $1, $2 and $3 contain the expected subject entity, property, and target entity of the missing symmetric statement.", - "wbqc-violation-message-type-instance": "Message for a violation of the “Type” constraint, when the subject of a statement should have be an instance of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-subclass}}", - "wbqc-violation-message-type-subclass": "Message for a violation of the “Type” constraint, when the subject of a statement should have be a subclass of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-instance}}", - "wbqc-violation-message-valueType-instance": "Message for a violation of the “Value type” constraint, when the value of a statement should have be an instance of a certain type but isn't. $1 is the property of the statement, $2 is the value of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-valueType-subclass}}", - "wbqc-violation-message-valueType-subclass": "Message for a violation of the “Value type” constraint, when the value of a statement should have be a subclass of a certain type but isn't. $1 is the property of the statement, $2 is the value of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-valueType-instance}}", + "wbqc-violation-message-type-instance": "Message for a violation of the “Type” constraint, when the subject of a statement should be an instance of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-subclass}}", + "wbqc-violation-message-type-subclass": "Message for a violation of the “Type” constraint, when the subject of a statement should be a subclass of a certain type but isn't. $1 is the property of the statement, $2 is the subject of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-type-instance}}", + "wbqc-violation-message-valueType-instance": "Message for a violation of the “Value type” constraint, when the value of a statement should be an instance of a certain type but isn't. $1 is the property of the statement, $2 is the value of the statement, $3 is the number of classes, $4 is an HTML list of all classes, and $5, $6 etc. are the individual classes.\n{{Related|wbqc-violation-message-valueType-subclass}}", + "wbqc-violation-message-valueType-subclass": "Message for a violation of the “Value type” constraint, when the value of a statement should be a subclass of a certain type but isn'
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add support for “instance or subclass of” relation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404711 ) Change subject: Add support for “instance or subclass of” relation .. Add support for “instance or subclass of” relation The “instance or subclass of” relation is the union of the “instance of” and “subclass of” relations: the link from the item to the class can either be via the “instance of” property or via the “subclass of” property. After that, as usual, only “subclass of” is processed: the relation does *not* mean that “instance of” and “subclass of” can be mixed in the whole hierarchy – only on the first link! TypeCheckerHelper::hasClassInRelation is changed to accept a list of relation property IDs instead of a single one, and gains a new helper function to extract statements of several property IDs from a StatementList (since StatementList doesn’t have such a function, as far as I can tell). The two checkers translate the new relation type to a relation property ID list of both the “instance of” and the “subclass of” property ID. Bug: T169858 Change-Id: Iedfe3013a10de0af7f12ea0f6fde7164dbe4f062 --- M i18n/en.json M i18n/qqq.json M src/ConstraintCheck/Checker/TypeChecker.php M src/ConstraintCheck/Checker/ValueTypeChecker.php M src/ConstraintCheck/Helper/TypeCheckerHelper.php M tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php M tests/phpunit/Checker/TypeChecker/TypeCheckerTest.php M tests/phpunit/Checker/TypeChecker/ValueTypeCheckerTest.php 8 files changed, 160 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/11/404711/1 diff --git a/i18n/en.json b/i18n/en.json index 2327d3e..090bdac 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -136,8 +136,10 @@ "wbqc-violation-message-symmetric": "$1 should also have the symmetric statement $2 $3.", "wbqc-violation-message-type-instance": "Entities using the $1 property should be instances of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-type-subclass": "Entities using the $1 property should be subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", + "wbqc-violation-message-type-instanceOrSubclass": "Entities using the $1 property should be instances or subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-valueType-instance": "Values of $1 statements should be instances of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-valueType-subclass": "Values of $1 statements should be subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", + "wbqc-violation-message-valueType-instanceOrSubclass": "Values of $1 statements should be instances or subclasses of {{PLURAL:$3|1=$5|2=$5 or $6|one of the following classes}} (or of {{PLURAL:$3|1=a subclass of it|2=a subclass of them|one of their subclasses}}), but $2 currently {{PLURAL:$3|1=isn't.|2=isn't.|isn't: $4}}", "wbqc-violation-message-target-required-claim": "$1 should have {{PLURAL:$3|0=a statement $2.|1=a statement $2 $5.|a statement for $2 with one of the following values:$4}}", "wbqc-violation-message-unique-value": "This property's value must not be present on any other item, but is also present on {{PLURAL:$1|1=$3.|2=$3 and $4.|the following items: $2}}", "wbqc-violation-message-valueOnly": "This property should only be used for the main value of a statement, not for qualifiers or references.", diff --git a/i18n/qqq.json b/i18n/qqq.json index 0fa388a..283dc8d 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -134,8 +134,10 @@ "wbqc-violation-message-symmetric": "Message for a violation of the “Symmetric” constraint, when the symmetric statemen
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Improve TypeCheckerHelperTest function names
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404707 ) Change subject: Improve TypeCheckerHelperTest function names .. Improve TypeCheckerHelperTest function names Similar to commit 2c47030aa9 (change I2a74c79265), an underscore is added in the test function name between the name of the function under test and the details. The name of the function under test is also sometimes adjusted (“IsSubclass” → “IsSubclassOf”), and the redundant “Check” prefix is removed everywhere. Change-Id: I5ddb849bbcc6529d2388d815f654ecd0c8b6bbf5 --- M tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php 1 file changed, 10 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/07/404707/1 diff --git a/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php b/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php index c3072d7..79df966 100644 --- a/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php +++ b/tests/phpunit/Checker/TypeChecker/TypeCheckerHelperTest.php @@ -93,56 +93,56 @@ return $mock; } - public function testCheckHasClassInRelationValid() { + public function testHasClassInRelation_Valid() { $statement1 = new Statement( new PropertyValueSnak( new PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) ); $statement2 = new Statement( new PropertyValueSnak( new PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q1' ) ) ) ); $statements = new StatementList( [ $statement1, $statement2 ] ); $this->assertTrue( $this->getHelper()->hasClassInRelation( $statements, 'P31', [ 'Q1' ] )->getBool() ); } - public function testCheckHasClassInRelationInvalid() { + public function testHasClassInRelation_Invalid() { $statement1 = new Statement( new PropertyValueSnak( new PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) ); $statement2 = new Statement( new PropertyValueSnak( new PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q100' ) ) ) ); $statements = new StatementList( [ $statement1, $statement2 ] ); $this->assertFalse( $this->getHelper()->hasClassInRelation( $statements, 'P31', [ 'Q1' ] )->getBool() ); } - public function testCheckHasClassInRelationValidWithIndirection() { + public function testHasClassInRelation_ValidWithIndirection() { $statement1 = new Statement( new PropertyValueSnak( new PropertyId( 'P1' ), new EntityIdValue( new ItemId( 'Q42' ) ) ) ); $statement2 = new Statement( new PropertyValueSnak( new PropertyId( 'P31' ), new EntityIdValue( new ItemId( 'Q5' ) ) ) ); $statements = new StatementList( [ $statement1, $statement2 ] ); $this->assertTrue( $this->getHelper()->hasClassInRelation( $statements, 'P31', [ 'Q4' ] )->getBool() ); } - public function testCheckIsSubclassOfValidWithIndirection() { + public function testIsSubclassOf_ValidWithIndirection() { $this->assertTrue( $this->getHelper()->isSubclassOfWithSparqlFallback( new ItemId( 'Q6' ), [ 'Q100', 'Q101' ] )->getBool() ); } - public function testCheckIsSubclassOfInvalid() { + public function testIsSubclassOf_Invalid() { $this->assertFalse( $this->getHelper()->isSubclassOfWithSparqlFallback( new ItemId( 'Q6' ), [ 'Q200', 'Q201' ] )->getBool() ); } - public function testCheckIsSubclassCyclic() { + public function testIsSubclassOf_Cyclic() { $helper = $this->getHelper( $this->getMaxEntitiesLookup() ); $this->assertFalse( $helper->isSubclassOfWithSparqlFallback( new ItemId( 'Q7' ), [ 'Q100', 'Q101' ] )->getBool() ); } - public function testCheckIsSubclassCyclicWide() { + public function testIsSubclassOf_CyclicWide() { $helper = $this->getHelper( $this->getMaxEntitiesLookup() ); $this->assertFalse( $helper->isSubclassOfWithSparqlFallback( new ItemId( 'Q9' ), [ 'Q100', 'Q101' ] )->getBool() ); } - public function testCheckIsSubclassCyclicWideWithSparqlTrue() { + public function testIsSubclassOf_CyclicWideWithSparqlTrue() { $helper = $this->getHelper( $this->getMaxEntitiesLookup(), $this->getSparqlHelper( true
[MediaWiki-commits] [Gerrit] integration/config[master]: Add selenium to AdvancedSearch experimental
Pablo Grass (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404702 ) Change subject: Add selenium to AdvancedSearch experimental .. Add selenium to AdvancedSearch experimental To develop first browser tests for AdvancedSearch Bug: T184608 Change-Id: Ib8fa03b2cc018c39fddda7872887fa8756ea5895 --- M zuul/layout.yaml 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/integration/config refs/changes/02/404702/1 diff --git a/zuul/layout.yaml b/zuul/layout.yaml index 0b8a980..19a3779 100644 --- a/zuul/layout.yaml +++ b/zuul/layout.yaml @@ -2831,6 +2831,8 @@ - name: extension-qunit-generic - name: extension-unittests-generic - name: mwgate-npm +experimental: + - mediawiki-core-qunit-selenium-jessie - name: mediawiki/extensions/AdminLinks template: -- To view, visit https://gerrit.wikimedia.org/r/404702 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib8fa03b2cc018c39fddda7872887fa8756ea5895 Gerrit-PatchSet: 1 Gerrit-Project: integration/config Gerrit-Branch: master Gerrit-Owner: Pablo Grass (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Integrate all Client's repository settings into a single set...
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404679 ) Change subject: Integrate all Client's repository settings into a single setting .. Integrate all Client's repository settings into a single setting This renames "foreignRepositories" setting to "repositories", and moves the configuration of the "local" repository, to the "repositories" setting. Resubmitting I2eee36256260490d7b3ddf6c83389f810239835c with proper handling of "old" "local" repository setting Bug: T153767 Change-Id: Ibbdb5d0317ef741b4d755b932b4317e3b3bd2a07 --- M client/config/WikibaseClient.default.php M client/config/WikibaseClient.example.php M client/includes/Hooks/UpdateRepoHookHandlers.php M client/includes/WikibaseClient.php M client/maintenance/updateSubscriptions.php M client/tests/phpunit/ClientDefaultsTest.php M client/tests/phpunit/includes/DataAccess/DataAccessSnakFormatterOutputFormatTest.php M client/tests/phpunit/includes/Usage/UsageTrackingIntegrationTest.php A client/tests/phpunit/includes/WikibaseClientRepositorySettingsTest.php M docs/federation.wiki M docs/options.wiki M lib/includes/WikibaseSettings.php 12 files changed, 395 insertions(+), 105 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/79/404679/1 diff --git a/client/config/WikibaseClient.default.php b/client/config/WikibaseClient.default.php index 312edac..7380d59 100644 --- a/client/config/WikibaseClient.default.php +++ b/client/config/WikibaseClient.default.php @@ -90,8 +90,6 @@ // repo and clients for multiwiki setups. 'sharedCacheType' => $GLOBALS['wgMainCacheType'], - 'foreignRepositories' => [], - // Enable writing of term_full_entity_id column in wb_terms table. 'writeFullEntityIdColumn' => function ( SettingsArray $settings ) { return $settings->hasSetting( 'hasFullEntityIdColumn' ) ? @@ -132,6 +130,30 @@ return WikibaseSettings::isRepoEnabled(); }; + $defaults['repositories'] = function ( SettingsArray $settings ) { + // XXX: Default to having Items in the main namespace, and properties in NS 120. + // That is the live setup at wikidata.org, it is NOT consistent with the example settings! + // FIXME: throw an exception, instead of making assumptions that may brak the site in strange ways! + $entityNamespaces = [ + 'item' => 0, + 'property' => 120 + ]; + if ( $settings->getSetting( 'thisWikiIsTheRepo' ) ) { + $entityNamespaces = WikibaseSettings::getRepoSettings()->getSetting( 'entityNamespaces' ); + } + + return [ + '' => [ + // Use false (meaning the local wiki's database) if this wiki is the repo, + // otherwise default to null (meaning we can't access the repo's DB directly). + 'repoDatabase' => $settings->getSetting( 'thisWikiIsTheRepo' ) ? false : null, + 'baseUri' => $settings->getSetting( 'repoUrl' ) . '/entity/', + 'entityNamespaces' => $entityNamespaces, + 'prefixMapping' => [ '' => '' ], + ] + ]; + }; + $defaults['repoSiteName'] = function ( SettingsArray $settings ) { // This uses $wgSitename if this wiki is the repo. Otherwise, set this to // either an i18n message key and the message will be used, if it exists. @@ -144,10 +166,6 @@ return $settings->getSetting( 'thisWikiIsTheRepo' ) ? $GLOBALS['wgServer'] : '//www.wikidata.org'; }; - $defaults['repoConceptBaseUri'] = function ( SettingsArray $settings ) { - return $settings->getSetting( 'repoUrl' ) . '/entity/'; - }; - $defaults['repoArticlePath'] = function ( SettingsArray $settings ) { // use $wgArticlePath if this wiki is the repo, otherwise default to /wiki/$1 return $settings->getSetting( 'thisWikiIsTheRepo' ) ? $GLOBALS['wgArticlePath'] : '/wiki/$1'; @@ -158,32 +176,12 @@ return $settings->getSetting( 'thisWikiIsTheRepo' ) ? $GLOBALS['w
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Generate same HTML for grammatical features server-side that...
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404668 ) Change subject: Generate same HTML for grammatical features server-side that client JS does .. Generate same HTML for grammatical features server-side that client JS does Change-Id: I433a1cd4f1e06d4411189b58490fe1303e31627b --- M src/View/FormsView.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/68/404668/1 diff --git a/src/View/FormsView.php b/src/View/FormsView.php index 2f7dec9..e515223 100644 --- a/src/View/FormsView.php +++ b/src/View/FormsView.php @@ -86,7 +86,7 @@ $this->textProvider->get( 'comma-separator' ), array_map( function ( ItemId $id ) { - return $this->getGrammaticalFeatureHtml( $id ); + return '' . $this->getGrammaticalFeatureHtml( $id ) . ''; }, $form->getGrammaticalFeatures() ) -- To view, visit https://gerrit.wikimedia.org/r/404668 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I433a1cd4f1e06d4411189b58490fe1303e31627b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: WMDE-leszek ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: When running Selenium tests, use `wd/hub`
WMDE-Fisch has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/404507 ) Change subject: When running Selenium tests, use `wd/hub` .. When running Selenium tests, use `wd/hub` It works both on Mac and Windows. I am assuming it works on Linux too. Bug: T182421 Change-Id: I85a9e7dbd9a66418c85585969adb5ac1548f5ef6 --- M tests/selenium/README.md 1 file changed, 1 insertion(+), 3 deletions(-) Approvals: WMDE-Fisch: Verified; Looks good to me, approved diff --git a/tests/selenium/README.md b/tests/selenium/README.md index 6fad6fe..1628377 100644 --- a/tests/selenium/README.md +++ b/tests/selenium/README.md @@ -23,9 +23,7 @@ To run only one file (for example page.js), you first need to spawn the chromedriver: -chromedriver --url-base=/wd/hub --port= - -Note: On Windows you may need to use "--url-base=wd/hub" +chromedriver --url-base=wd/hub --port= Then in another terminal: -- To view, visit https://gerrit.wikimedia.org/r/404507 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I85a9e7dbd9a66418c85585969adb5ac1548f5ef6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Zfilipin Gerrit-Reviewer: Addshore Gerrit-Reviewer: Hashar Gerrit-Reviewer: WMDE-Fisch Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] wikidata...gui[master]: Disable no-descending-specificity stylelint rule
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404508 ) Change subject: Disable no-descending-specificity stylelint rule .. Disable no-descending-specificity stylelint rule The rule is sometimes hard to satisfy, especially given our mixture of styling by ID and styling by class (which have different specificity). Perhaps we can reintroduce it at some point, but for now, I8447b28c0d introduces a case of descending specificity that I can’t think of a good way to resolve, so I’m disabling the rule. Change-Id: I96313c6bc311b2defc762ab6b8f4665dacd47817 --- M .stylelintrc 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/08/404508/1 diff --git a/.stylelintrc b/.stylelintrc index f475e7f..677a7a6 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -4,6 +4,7 @@ "color-named": null, "declaration-no-important": null, "declaration-property-value-blacklist": null, + "no-descending-specificity": null, "selector-no-id": null } } -- To view, visit https://gerrit.wikimedia.org/r/404508 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I96313c6bc311b2defc762ab6b8f4665dacd47817 Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Revert "Integrate all Client's repository settings into a si...
RightsText setting. ;sparqlEndpoint: URL to the service description of the SPARQL end point for the repository. Defaults to null, meaning there is no SPARQL endpoint. @@ -39,11 +44,6 @@ ;conceptBaseUri: Base URI for building concept URIs (for example used in Rdf output). This has to include the protocol and domain, only an entity identifier will be appended. ;preferredGeoDataProperties: List of properties (by ID string), in order of preference, that are considered when finding primary coordinates for the GeoData extension on an entity. Defaults to an empty array. ;localClientDatabases: An array of locally accessible client databases, for use by the dispatchChanges.php script. This setting determines to which wikis changes are pushed directly. It must be given either as an associative array, mapping global site IDs to logical database names, or, of the database names are the same as the site IDs, as a list of databases. The default is an empty array, indicating no local client databases. -;foreignRepositories: An associative array mapping foreign repository names to settings relevant to the particular repository. Each repository's settings are an associative array containing the following keys: -:;'entityNamespaces': A map of entity type identifiers (strings) that the local wiki supports from the foreign repository to namespaces identifiers (numbers) related to pages of entities of the given type on foreign repository's wiki.. -:;'repoDatabase': A symbolic database identifier (string) that MediaWiki's LBFactory class understands. -:;'baseUri': A base URI (string) for concept URIs. It should contain scheme and authority part of the URI. -:;'prefixMapping': A prefix mapping array, see also: docs/foreign-entity-ids.wiki in the DataModel component. === Expert Settings === @@ -79,12 +79,9 @@ ;namespaces: List of namespaces on the client wiki that should have access to repository items. Default: array() (treated as setting is not set, ie. namespaces are enabled). ;excludeNamespaces: List of namespaces on the client wiki to disable wikibase links, etc. for. Default: array(). Example: array( NS_USER_TALK ). -;repositories: An associative array mapping repository names to settings relevant to the particular repository. Local repository is identified using the empty string as its name. Each repository's settings are an associative array containing the following keys: -:;'entityNamespaces': A map of entity type identifiers (strings) that the local wiki supports from the foreign repository to namespaces identifiers (numbers) related to pages of entities of the given type on foreign repository's wiki.. -:;'repoDatabase': A symbolic database identifier (string) that MediaWiki's LBFactory class understands. Note that false would mean "this wiki's database"! -:;'baseUri': A base URI (string) for concept URIs. It should contain scheme and authority part of the URI. -:;'prefixMapping': A prefix mapping array, see also: docs/foreign-entity-ids.wiki in the DataModel component. ;repoUrl: The repository's base URL, including the schema (protocol) and domain; This URL can be protocol-relative. Default is '//wikidata.org'. +:'''Note:''' This may be removed once we can get this information from the sites table. +;repoConceptBaseUri: The base of the repository's concept URIs. Default is 'repoUrl/entity/'. :'''Note:''' This may be removed once we can get this information from the sites table. ;repoScriptPath: The repository's script path. Default is $wgScriptPath, assuming that the repo's script path is the same as this wiki's script path. :'''Note:''&
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Remove useless select from SPARQL query
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404476 ) Change subject: Remove useless select from SPARQL query .. Remove useless select from SPARQL query We don’t use ?entity, so there’s no need to include it in the SELECT. Change-Id: Ie2063797d7d26eb570ba4d544d4ad555a72ae33f --- M src/ConstraintCheck/Helper/SparqlHelper.php M tests/phpunit/Helper/SparqlHelperTest.php 2 files changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/76/404476/1 diff --git a/src/ConstraintCheck/Helper/SparqlHelper.php b/src/ConstraintCheck/Helper/SparqlHelper.php index 3855258..42d98c9 100644 --- a/src/ConstraintCheck/Helper/SparqlHelper.php +++ b/src/ConstraintCheck/Helper/SparqlHelper.php @@ -237,7 +237,7 @@ } $query = <<getMock(); $query = <<https://gerrit.wikimedia.org/r/404476 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie2063797d7d26eb570ba4d544d4ad555a72ae33f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add missing DISTINCT to SPARQL query
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404477 ) Change subject: Add missing DISTINCT to SPARQL query .. Add missing DISTINCT to SPARQL query Bug: T184705 Change-Id: Ie76949e4b85e9529b5b721691e5e6e5b8c46d319 --- M src/ConstraintCheck/Helper/SparqlHelper.php M tests/phpunit/Helper/SparqlHelperTest.php 2 files changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/77/404477/1 diff --git a/src/ConstraintCheck/Helper/SparqlHelper.php b/src/ConstraintCheck/Helper/SparqlHelper.php index 42d98c9..54bf3f7 100644 --- a/src/ConstraintCheck/Helper/SparqlHelper.php +++ b/src/ConstraintCheck/Helper/SparqlHelper.php @@ -179,7 +179,7 @@ } $query = <<getMock(); $query = <<getMock(); $query = <<https://gerrit.wikimedia.org/r/404477 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie76949e4b85e9529b5b721691e5e6e5b8c46d319 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Fix status parameter documentation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404326 ) Change subject: Fix status parameter documentation .. Fix status parameter documentation Originally, I had planned to support caching for requests with e. g. only the violation|warning statuses as well. However, while implementing this, I realized that removing results from the response array structure is not trivial, and so I changed my mind and we now only cache results for requests which specify exactly the right three statuses. Unfortunately, I failed to update the commit message to account for this change. Bug: T183927 Change-Id: Id81382c35aa5cac5a995432673727bc53bff9eec --- M i18n/en.json 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/26/404326/1 diff --git a/i18n/en.json b/i18n/en.json index 7bb971a..f10ed45 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -54,7 +54,7 @@ "apihelp-wbcheckconstraints-param-id": "ID list of the entities to get the data from. Separate values with '|' or alternative.", "apihelp-wbcheckconstraints-param-claimid": "GUID list identifying a claim to check a constraint report. Separate values with '|'.", "apihelp-wbcheckconstraints-param-constraintid": "Optional filter to return only the constraints that have the specified constraint ID.", - "apihelp-wbcheckconstraints-param-status": "Optional filter to return only check results with the selected statuses.\n\nNote that only results for the 'violation', 'warning' and 'bad-parameters' statuses are cached, so any request that is not limited to only those statuses (or a subset of them) does not benefit from caching.", + "apihelp-wbcheckconstraints-param-status": "Optional filter to return only check results with the selected statuses.\n\nNote that only results for the 'violation', 'warning' and 'bad-parameters' statuses are cached, so only requests that are limited to exactly those statuses benefit from caching.", "apihelp-wbcheckconstraints-paramvalue-status-compliance": "The statement satisfies the constraint.", "apihelp-wbcheckconstraints-paramvalue-status-violation": "The statement violates the constraint.", "apihelp-wbcheckconstraints-paramvalue-status-exception": "The subject entity of the statement is a known exception to the constraint.", -- To view, visit https://gerrit.wikimedia.org/r/404326 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id81382c35aa5cac5a995432673727bc53bff9eec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add status parameter to gadget’s API requests
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404322 ) Change subject: Add status parameter to gadget’s API requests .. Add status parameter to gadget’s API requests Only with this parameter does the gadget benefit from server-side caching, otherwise it requests lots of results which we don’t cache and which therefore require a full constraint check. (Note: for the check of an individual statement, we don’t cache results either, but specifying the status at least reduces the response size.) Bug: T183927 Change-Id: I7457566fdf4181719473dfc84e3ff872b49b3d4b --- M modules/gadget.js 1 file changed, 6 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/22/404322/1 diff --git a/modules/gadget.js b/modules/gadget.js index b368d6e..da4d542 100644 --- a/modules/gadget.js +++ b/modules/gadget.js @@ -1,7 +1,8 @@ ( function( mw, wb, $, OO ) { 'use strict'; - var entityId; + var entityId, + cachedStatuses = 'violation|warning|bad-parameters'; function buildPopup( $content, $container, icon, iconTitleMessageKey, flags /* = '' */ ) { var widget = new OO.ui.PopupButtonWidget( { @@ -311,7 +312,8 @@ format: 'json', formatversion: 2, uselang: lang, - id: entityId + id: entityId, + status: cachedStatuses } ).then( function( data ) { $( '.wikibase-statementgroupview .wikibase-statementview' ) .each( function () { addReportsToStatement( data.wbcheckconstraints[ entityId ], $( this ) ); } ); @@ -337,7 +339,8 @@ format: 'json', formatversion: 2, uselang: lang, - claimid: statementId + claimid: statementId, + status: cachedStatuses } ).then( function( data ) { var statementClass = 'wikibase-statement-' + statementId.replace( /\$/, '\\$$' ); $( '.wikibase-statementgroupview .wikibase-statementview.' + statementClass ) -- To view, visit https://gerrit.wikimedia.org/r/404322 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7457566fdf4181719473dfc84e3ff872b49b3d4b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: [WIP] WikiDiff PHPunit Tests
Andrew-WMDE has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/404294 ) Change subject: [WIP] WikiDiff PHPunit Tests .. [WIP] WikiDiff PHPunit Tests Bug: T183131 Change-Id: Ib2f401b8155d3ae815e7ef1ec31385f96ecf6328 --- A tests/phpunit/includes/diff/wikidiff/WikiDiffTest.php A tests/phpunit/includes/diff/wikidiff/files/1/a.txt A tests/phpunit/includes/diff/wikidiff/files/1/b.txt A tests/phpunit/includes/diff/wikidiff/files/1/res.txt A tests/phpunit/includes/diff/wikidiff/files/2/a.txt A tests/phpunit/includes/diff/wikidiff/files/2/b.txt A tests/phpunit/includes/diff/wikidiff/files/2/res.txt 7 files changed, 421 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/94/404294/1 diff --git a/tests/phpunit/includes/diff/wikidiff/WikiDiffTest.php b/tests/phpunit/includes/diff/wikidiff/WikiDiffTest.php new file mode 100644 index 000..aad4b0a --- /dev/null +++ b/tests/phpunit/includes/diff/wikidiff/WikiDiffTest.php @@ -0,0 +1,37 @@ + + * + * @group Diff + */ +class WikiDiffTest extends MediaWikiTestCase { + + /** +* @var DifferenceEngine +*/ + private $diffEngine; + + protected function setUp() { + parent::setUp(); + $this->diffEngine = new DifferenceEngine(); + } + + private function getTestCases() { + return [ + [1, "Honeyguide"], + [2, "Rogers"] + ]; + } + + public function testDiffOutput() { + foreach ($this->getTestCases() as $case) { + $fileA = file_get_contents(__DIR__ . "/files/" . $case[0] . "/a.txt"); + $fileB = file_get_contents(__DIR__ . "/files/" . $case[0] . "/b.txt"); + $fileRes = file_get_contents(__DIR__ . "/files/" . $case[0] . "/res.txt"); + + $diff = $this->diffEngine->generateTextDiffBody($fileA, $fileB); + $this->assertEquals($fileRes, $diff, $case[1]); + } + } +} \ No newline at end of file diff --git a/tests/phpunit/includes/diff/wikidiff/files/1/a.txt b/tests/phpunit/includes/diff/wikidiff/files/1/a.txt new file mode 100644 index 000..8e6affd --- /dev/null +++ b/tests/phpunit/includes/diff/wikidiff/files/1/a.txt @@ -0,0 +1,82 @@ +{{Automatic Taxobox +| name = Honeyguides +| image = Wahlberg's Honeyguide (Prodotiscus regulus).jpg +| image_caption = [[Brown-backed honeybird]] +| taxon = Indicatoridae +| authority = [[William John Swainson|Swainson]], 1837 +| subdivision_ranks = Genera +| subdivision = +''[[Indicator (genus)|Indicator]]'' +''[[Melichneutes]]'' +''[[Melignomon]]'' +''[[Prodotiscus]]'' +}} + +'''Honeyguides''' ([[family (biology)|family]] '''Indicatoridae''') are [[near passerine]] [[bird]] species of the order [[Piciformes]]. They are also known as '''indicator birds''', or '''honey birds''', although the latter term is also used more narrowly to refer to species of the genus ''[[Prodotiscus]]''. They have an [[Old World]] tropical distribution, with the greatest number of species in [[Africa]] and two in [[Asia]]. These birds are best known for their interaction with humans. Honeyguides are noted and named for one or two species that will deliberately lead humans (but, contrary to popular claims, not [[honey badger]]s) directly to bee colonies, so that they can feast on the grubs and [[beeswax]] that are left behind. + +== Description == +[[File:Wahlberg's Honeyguide (Prodotiscus regulus) - Juvenile fed by host parent Rock-loving Cisticola.jpg|thumb|left|[[Brown-backed honeybird]] juvenile fed by host parent, a [[rock-loving cisticola + +Most honeyguides are dull-colored, though some have bright yellow coloring in the plumage. All have light outer tail feathers, which are white in all the African species. + +They are among the few birds that feed regularly on [[wax]]—[[beeswax]] in most species, and presumably the waxy secretions of [[scale insect]]s in the genus ''[[Prodotiscus]]'' and to a lesser extent in ''[[Melignomon]]'' and the smaller species of ''[[Indicator (genus)|Indicator]]''. They also feed on [[waxworm]]s which are the larvae of the waxmoth ''Galleria mellonella'', on [[bee]] colonies, and on flying and crawling insects, [[spider]]s, and occasional fruits. Many species join [[mixed-species feeding flock]]s. + +==Behavior== +===Guiding=== + +Honeyguides are named for a remarkable habit
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: selenium, update page spec to include more chars
WMDE-Fisch has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/404075 ) Change subject: selenium, update page spec to include more chars .. selenium, update page spec to include more chars Bug: T184749 Change-Id: I3423011c467b0a6426cfa0dad522435618f24bd0 --- M tests/selenium/specs/page.js 1 file changed, 8 insertions(+), 6 deletions(-) Approvals: Daniel Kinzler: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/selenium/specs/page.js b/tests/selenium/specs/page.js index 06d3d60..e59da78 100644 --- a/tests/selenium/specs/page.js +++ b/tests/selenium/specs/page.js @@ -9,6 +9,10 @@ var content, name; + function getTestString() { + return Math.random().toString() + '-öäü-♠♣♥♦'; + } + before( function () { // disable VisualEditor welcome dialog UserLoginPage.open(); @@ -17,8 +21,8 @@ beforeEach( function () { browser.deleteCookie(); - content = Math.random().toString(); - name = Math.random().toString(); + content = getTestString(); + name = getTestString(); } ); it( 'should be creatable', function () { @@ -34,19 +38,17 @@ it( 'should be editable', function () { - var content2 = Math.random().toString(); - // create browser.call( function () { return EditPage.apiEdit( name, content ); } ); // edit - EditPage.edit( name, content2 ); + EditPage.edit( name, content ); // check assert.equal( EditPage.heading.getText(), name ); - assert.equal( EditPage.displayedContent.getText(), content2 ); + assert.equal( EditPage.displayedContent.getText(), content ); } ); -- To view, visit https://gerrit.wikimedia.org/r/404075 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3423011c467b0a6426cfa0dad522435618f24bd0 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Addshore Gerrit-Reviewer: Daniel Kinzler Gerrit-Reviewer: WMDE-Fisch Gerrit-Reviewer: Zfilipin Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Fix mistakes and refactor FormDiffView and related
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403969 ) Change subject: Fix mistakes and refactor FormDiffView and related .. Fix mistakes and refactor FormDiffView and related I believe this is all very much trivial refactoring. This patch also fixes a few mistakes, but these happened in comments. Bug: T182424 Change-Id: I4e6b9531d56405e8d2c72d501c322ab71e6ead29 --- M src/Diff/FormDiffView.php M src/Diff/LexemeDiffVisualizer.php M tests/phpunit/mediawiki/Diff/FormDiffViewTest.php 3 files changed, 54 insertions(+), 60 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/69/403969/1 diff --git a/src/Diff/FormDiffView.php b/src/Diff/FormDiffView.php index 1d82223..38c46e8 100644 --- a/src/Diff/FormDiffView.php +++ b/src/Diff/FormDiffView.php @@ -22,12 +22,12 @@ class FormDiffView extends BasicDiffView { /** -* @var ClaimDiffer|null +* @var ClaimDiffer */ private $claimDiffer; /** -* @var ClaimDifferenceVisualizer|null +* @var ClaimDifferenceVisualizer */ private $claimDiffVisualizer; @@ -61,26 +61,29 @@ * @param string[] $path * @param DiffOp $op * -* @return string -* @throws MWException +* @return string HTML */ protected function generateOpHtml( array $path, DiffOp $op ) { - $html = ''; if ( $op->isAtomic() ) { return parent::generateOpHtml( $path, $op ); } + + $html = ''; + foreach ( $op as $key => $subOp ) { - if ( !$subOp instanceof ChangeFormDiffOp ) { - $html .= $this->generateOpHtml( array_merge( $path, [ $key ] ), $subOp ); - } else { + if ( $subOp instanceof ChangeFormDiffOp ) { $html .= $this->generateFormOpHtml( $path, $subOp, $key ); + } else { + $html .= $this->generateOpHtml( array_merge( $path, [ $key ] ), $subOp ); } } + return $html; } - private function generateFormOpHtml( $path, ChangeFormDiffOp $op, $key ) { + private function generateFormOpHtml( array $path, ChangeFormDiffOp $op, $key ) { $html = ''; + foreach ( $op->getStatementsDiffOps() as $claimDiffOp ) { $html .= $this->getClaimDiffHtml( $claimDiffOp, @@ -108,33 +111,31 @@ } /** -* @param DiffOp $claimDiffOp +* @param DiffOp $diffOp * * @return string HTML * @throws MWException */ - protected function getClaimDiffHtml( DiffOp $claimDiffOp, array $path ) { - if ( $claimDiffOp instanceof DiffOpChange ) { - $claimDifference = $this->claimDiffer->diffClaims( - $claimDiffOp->getOldValue(), - $claimDiffOp->getNewValue() - ); - return $this->claimDiffVisualizer->visualizeClaimChange( - $claimDifference, - $claimDiffOp->getNewValue(), - $path - ); - } + private function getClaimDiffHtml( DiffOp $diffOp, array $path ) { + switch ( true ) { + case $diffOp instanceof DiffOpChange: + return $this->claimDiffVisualizer->visualizeClaimChange( + $this->claimDiffer->diffClaims( + $diffOp->getOldValue(), + $diffOp->getNewValue() + ), + $diffOp->getNewValue(), + $path + ); - if ( $claimDiffOp instanceof DiffOpAdd ) { - return $this->claimDiffVisualizer->visualizeNewClaim( $claimDiffOp->getNewValue(), $path ); - } elseif ( $claimDiffOp instanceof DiffOpRemove ) { - return $this->claimDiffVisualizer->visualizeRemovedClaim( - $claimDiffOp->getOldValue(), - $path - ); - } else { - throw new MWException( 'Encountered an unexpected diff operation type for a claim' ); + case $di
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add $statuses parameter to ResultsBuilder::getResults
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403966 ) Change subject: Add $statuses parameter to ResultsBuilder::getResults .. Add $statuses parameter to ResultsBuilder::getResults This parameter filters the check results represented in the final result to only those listed in the $statuses. CheckingResultsBuilder implements this filtering, and CachingResultsBuilder caches only those results where the $statuses are exactly those three statuses which are also displayed in the gadget. Bug: T183927 Change-Id: I3ff5f8d6b0a16a4aa2417b0f1e03b8634376a6dd --- M src/Api/CachingResultsBuilder.php M src/Api/CheckingResultsBuilder.php M src/Api/ResultsBuilder.php M tests/phpunit/Api/CachingResultsBuilderTest.php M tests/phpunit/Api/CheckingResultsBuilderTest.php 5 files changed, 276 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/66/403966/1 diff --git a/src/Api/CachingResultsBuilder.php b/src/Api/CachingResultsBuilder.php index 00b788a..fc98fc6 100644 --- a/src/Api/CachingResultsBuilder.php +++ b/src/Api/CachingResultsBuilder.php @@ -11,6 +11,7 @@ use WikibaseQuality\ConstraintReport\ConstraintCheck\Cache\CachingMetadata; use WikibaseQuality\ConstraintReport\ConstraintCheck\Cache\DependencyMetadata; use WikibaseQuality\ConstraintReport\ConstraintCheck\Cache\Metadata; +use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResult; /** * A wrapper around another ResultsBuilder that caches results in a ResultsCache. @@ -76,6 +77,15 @@ private $microtime = 'microtime'; /** +* TODO: In PHP 5.6, make this a public class constant instead, +* and also use it in CheckConstraints::getAllowedParams() +* and in some of the tests. +* +* @var string[] +*/ + private $cachedStatuses; + + /** * @param ResultsBuilder $resultsBuilder The ResultsBuilder that cache misses are delegated to. * @param ResultsCache $cache The cache where results can be stored. * @param WikiPageEntityMetaDataAccessor $wikiPageEntityMetaDataAccessor Used to get the latest revision ID. @@ -101,22 +111,30 @@ $this->ttlInSeconds = $ttlInSeconds; $this->possiblyStaleConstraintTypes = $possiblyStaleConstraintTypes; $this->dataFactory = $dataFactory; + + $this->cachedStatuses = [ + CheckResult::STATUS_VIOLATION, + CheckResult::STATUS_WARNING, + CheckResult::STATUS_BAD_PARAMETERS, + ]; } /** * @param EntityId[] $entityIds * @param string[] $claimIds * @param string[]|null $constraintIds +* @param string[] $statuses * @return CachedCheckConstraintsResponse */ public function getResults( array $entityIds, array $claimIds, - array $constraintIds = null + array $constraintIds = null, + array $statuses ) { $results = []; $metadatas = []; - if ( $this->canUseStoredResults( $entityIds, $claimIds, $constraintIds ) ) { + if ( $this->canUseStoredResults( $entityIds, $claimIds, $constraintIds, $statuses ) ) { $storedEntityIds = []; foreach ( $entityIds as $entityId ) { $storedResults = $this->getStoredResults( $entityId ); @@ -136,7 +154,7 @@ 'wikibase.quality.constraints.cache.entity.miss', count( $entityIds ) ); - $response = $this->getAndStoreResults( $entityIds, $claimIds, $constraintIds ); + $response = $this->getAndStoreResults( $entityIds, $claimIds, $constraintIds, $statuses ); $results += $response->getArray(); $metadatas[] = $response->getMetadata(); } @@ -147,37 +165,58 @@ } /** -* We can only use cached constraint results if full constraint check results were requested: +* We can only use cached constraint results +* if exactly the problematic results of a full constraint check were requested: * constraint checks for the full entity (not just individual statements), -* and without restricting the set of constraints to check. +* without restricting the set of constraints to check, +* and with exactly the 'violation', 'warning' and 'bad-parameters' statuses. +* +* (In theory, we could also use results for requests +
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add status parameter to CheckConstraints
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403967 ) Change subject: Add status parameter to CheckConstraints .. Add status parameter to CheckConstraints This new parameter of the wbcheckconstraints API corresponds to the $statuses parameter of ResultsBuilder and filters the returned check results. For now, the default value is '*' (all statuses) to preserve compatibility, but we plan to change it to just the three statuses for which results are also cached in the future. Bug: T183927 Change-Id: I69885a05734956722f939e8a71d1490afc8182ab --- M i18n/en.json M i18n/qqq.json M src/Api/CheckConstraints.php M src/ConstraintCheck/Result/CheckResult.php M tests/phpunit/Api/CheckConstraintsTest.php 5 files changed, 89 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/67/403967/1 diff --git a/i18n/en.json b/i18n/en.json index 2271b21..7bb971a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -54,6 +54,15 @@ "apihelp-wbcheckconstraints-param-id": "ID list of the entities to get the data from. Separate values with '|' or alternative.", "apihelp-wbcheckconstraints-param-claimid": "GUID list identifying a claim to check a constraint report. Separate values with '|'.", "apihelp-wbcheckconstraints-param-constraintid": "Optional filter to return only the constraints that have the specified constraint ID.", + "apihelp-wbcheckconstraints-param-status": "Optional filter to return only check results with the selected statuses.\n\nNote that only results for the 'violation', 'warning' and 'bad-parameters' statuses are cached, so any request that is not limited to only those statuses (or a subset of them) does not benefit from caching.", + "apihelp-wbcheckconstraints-paramvalue-status-compliance": "The statement satisfies the constraint.", + "apihelp-wbcheckconstraints-paramvalue-status-violation": "The statement violates the constraint.", + "apihelp-wbcheckconstraints-paramvalue-status-exception": "The subject entity of the statement is a known exception to the constraint.", + "apihelp-wbcheckconstraints-paramvalue-status-todo": "The constraint is not implemented.", + "apihelp-wbcheckconstraints-paramvalue-status-bad-parameters": "The constraint parameters are broken.", + "apihelp-wbcheckconstraints-paramvalue-status-deprecated": "The constraint has not been checked because the statement is deprecated.", + "apihelp-wbcheckconstraints-paramvalue-status-warning": "The statement violates the constraint, but the constraint is not mandatory.", + "apihelp-wbcheckconstraints-paramvalue-status-not-in-scope": "The constraint is not checked on this kind of snak (main snak, qualifier or reference), so the constraint check is skipped.", "apihelp-wbcheckconstraintparameters-summary": "Checks the constraint parameters of constraint statements.", "apihelp-wbcheckconstraintparameters-extended-description": "Either or both of the property and constraintid parameters may be specified; all constraints selected by either parameter will be checked.", "apihelp-wbcheckconstraintparameters-param-propertyid": "List of property IDs to check. All constraint statements of these properties will be checked.\n\nIf this parameter is specified, it must be nonempty.", diff --git a/i18n/qqq.json b/i18n/qqq.json index 657ebab..004758d 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -55,6 +55,15 @@ "apihelp-wbcheckconstraints-param-id": "{{doc-apihelp-param|wbcheckconstraints|id}}", "apihelp-wbcheckconstraints-param-claimid": "{{doc-apihelp-param|wbcheckconstraints|claimid}}", "apihelp-wbcheckconstraints-param-constraintid": "{{doc-apihelp-param|wbcheckconstraints|constraintid}}", + "apihelp-wbcheckconstraints-param-status": "{{doc-apihelp-param|wbcheckconstraints|status}}", + "apihelp-wbcheckconstraints-paramvalue-status-compliance": "{{doc-apihelp-paramvalue|wbcheckconstraints|status|compliance}}", + "apihelp-wbcheckconstraints-paramvalue-status-violation": "{{doc-apihelp-paramvalue|wbcheckconstraints|status|violation}}", + "apihelp-wbcheckconstraints-paramvalue-status-exception": "{{doc-apihelp-paramvalue|wbcheckconstraints|status|exception}}", + "apihelp-wbc
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Reformat CheckConstraints::getAllowedParams
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403964 ) Change subject: Reformat CheckConstraints::getAllowedParams .. Reformat CheckConstraints::getAllowedParams Fix the strange double indentation, and while we’re at it, also add trailing commas to make future diffs prettier. Change-Id: Ie131aa140a54d37d901c7b683100fc0d3959258f --- M src/Api/CheckConstraints.php 1 file changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/64/403964/1 diff --git a/src/Api/CheckConstraints.php b/src/Api/CheckConstraints.php index bcee76f..5f0676f 100644 --- a/src/Api/CheckConstraints.php +++ b/src/Api/CheckConstraints.php @@ -290,18 +290,18 @@ */ public function getAllowedParams() { return [ - self::PARAM_ID => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_ISMULTI => true - ], - self::PARAM_CLAIM_ID => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_ISMULTI => true - ], - self::PARAM_CONSTRAINT_ID => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_ISMULTI => true - ] + self::PARAM_ID => [ + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_ISMULTI => true, + ], + self::PARAM_CLAIM_ID => [ + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_ISMULTI => true, + ], + self::PARAM_CONSTRAINT_ID => [ + ApiBase::PARAM_TYPE => 'string', + ApiBase::PARAM_ISMULTI => true, + ], ]; } -- To view, visit https://gerrit.wikimedia.org/r/403964 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie131aa140a54d37d901c7b683100fc0d3959258f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Add missing period in API parameter documentation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403965 ) Change subject: Add missing period in API parameter documentation .. Add missing period in API parameter documentation Change-Id: I521d4c2ffae0cd257c0e254e2b3308fd2f5126eb --- M i18n/en.json 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/65/403965/1 diff --git a/i18n/en.json b/i18n/en.json index 8c65861..2271b21 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -53,7 +53,7 @@ "apihelp-wbcheckconstraints-summary": "Performs constraint checks on any entity you want and returns the result.", "apihelp-wbcheckconstraints-param-id": "ID list of the entities to get the data from. Separate values with '|' or alternative.", "apihelp-wbcheckconstraints-param-claimid": "GUID list identifying a claim to check a constraint report. Separate values with '|'.", - "apihelp-wbcheckconstraints-param-constraintid": "Optional filter to return only the constraints that have the specified constraint ID", + "apihelp-wbcheckconstraints-param-constraintid": "Optional filter to return only the constraints that have the specified constraint ID.", "apihelp-wbcheckconstraintparameters-summary": "Checks the constraint parameters of constraint statements.", "apihelp-wbcheckconstraintparameters-extended-description": "Either or both of the property and constraintid parameters may be specified; all constraints selected by either parameter will be checked.", "apihelp-wbcheckconstraintparameters-param-propertyid": "List of property IDs to check. All constraint statements of these properties will be checked.\n\nIf this parameter is specified, it must be nonempty.", -- To view, visit https://gerrit.wikimedia.org/r/403965 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I521d4c2ffae0cd257c0e254e2b3308fd2f5126eb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Move path array prepending logic to ClaimDifferenceVisualizer
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403963 ) Change subject: Move path array prepending logic to ClaimDifferenceVisualizer .. Move path array prepending logic to ClaimDifferenceVisualizer With this patch I am making the prepended path a private implementation detail of the ClaimDifferenceVisualizer class, and remove it entirely from DifferencesSnakVisualizer where it was before. That solves all concerns I had with the original patch Ia4bebd8: * The $path is not passed so deeply into code that does not really need to know anything about it. * Many of the optional $path parameters are gone. I had multiple reason to do it this way and would like to explain them, if needed. One reason is that a method called "getPropertyHeader" should only do exactly that: return the substring that describes a property. Note this patch does not change anything that is needed for I50eb048. The code I am touching in this patch is not used outside of the Wikibase code base. Bug: T182424 Change-Id: I0408672f42b9822f0fe380d8f692b15a7d64f73d --- M repo/includes/Diff/ClaimDifferenceVisualizer.php M repo/includes/Diff/DifferencesSnakVisualizer.php M repo/tests/phpunit/includes/Diff/DifferencesSnakVisualizerTest.php 3 files changed, 54 insertions(+), 57 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/63/403963/1 diff --git a/repo/includes/Diff/ClaimDifferenceVisualizer.php b/repo/includes/Diff/ClaimDifferenceVisualizer.php index d75f9a6..ab9 100644 --- a/repo/includes/Diff/ClaimDifferenceVisualizer.php +++ b/repo/includes/Diff/ClaimDifferenceVisualizer.php @@ -55,6 +55,7 @@ Statement $baseStatement, array $path = [] ) { + $headerPrefix = implode( ' / ', $path ) . ' / '; $newestMainSnak = $baseStatement->getMainSnak(); $oldestMainSnak = $newestMainSnak; $html = ''; @@ -63,40 +64,40 @@ if ( $mainSnakChange !== null ) { $oldestMainSnak = $mainSnakChange->getOldValue() ?: $newestMainSnak; $html .= $this->visualizeMainSnakChange( + $headerPrefix, $mainSnakChange, $oldestMainSnak, - $newestMainSnak, - $path + $newestMainSnak ); } $rankChange = $claimDifference->getRankChange(); if ( $rankChange !== null ) { $html .= $this->visualizeRankChange( + $headerPrefix, $rankChange, $oldestMainSnak, - $newestMainSnak, - $path + $newestMainSnak ); } $qualifierChanges = $claimDifference->getQualifierChanges(); if ( $qualifierChanges !== null ) { $html .= $this->visualizeQualifierChanges( + $headerPrefix, $qualifierChanges, $oldestMainSnak, - $newestMainSnak, - $path + $newestMainSnak ); } $referenceChanges = $claimDifference->getReferenceChanges(); if ( $referenceChanges !== null ) { $html .= $this->visualizeReferenceChanges( + $headerPrefix, $referenceChanges, $oldestMainSnak, - $newestMainSnak, - $path + $newestMainSnak ); } @@ -132,22 +133,22 @@ } /** +* @param string $headerPrefix * @param DiffOpChange $mainSnakChange * @param Snak $oldestMainSnak The old main snak, if present; otherwise, the new main snak * @param Snak $newestMainSnak The new main snak, if present; otherwise, the old main snak -* @param string[] $path The path to prepend in the header * * @return string HTML */ private function visualizeMainSnakChange( + $headerPrefix, DiffOpChange $mainSnakChange, Snak $oldestMainSnak, - Snak $newestMainSnak, - array $path + Snak $newestMainSnak ) { $value
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Remove PHPDoc blocks that just repeat the method header
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403955 ) Change subject: Remove PHPDoc blocks that just repeat the method header .. Remove PHPDoc blocks that just repeat the method header Such comments do not add any new information. Change-Id: Ib4e529310ef66d36b6909fff7d1b07afd53a3fe8 --- M src/DataModel/Lexeme.php M src/Rdf/LexemeRdfBuilder.php M tests/phpunit/composer/DataModel/Services/Diff/FormDifferPatcherTest.php 3 files changed, 1 insertion(+), 25 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/55/403955/1 diff --git a/src/DataModel/Lexeme.php b/src/DataModel/Lexeme.php index 2b64c7d..cc173be 100644 --- a/src/DataModel/Lexeme.php +++ b/src/DataModel/Lexeme.php @@ -208,9 +208,6 @@ return $this->lemmas; } - /** -* @param TermList $lemmas -*/ public function setLemmas( TermList $lemmas ) { $this->lemmas = $lemmas; } @@ -228,9 +225,6 @@ return $this->lexicalCategory; } - /** -* @param ItemId $lexicalCategory -*/ public function setLexicalCategory( ItemId $lexicalCategory ) { $this->lexicalCategory = $lexicalCategory; } @@ -248,9 +242,6 @@ return $this->language; } - /** -* @param ItemId $language -*/ public function setLanguage( ItemId $language ) { $this->language = $language; } diff --git a/src/Rdf/LexemeRdfBuilder.php b/src/Rdf/LexemeRdfBuilder.php index 476268e..bedb8c6 100644 --- a/src/Rdf/LexemeRdfBuilder.php +++ b/src/Rdf/LexemeRdfBuilder.php @@ -27,14 +27,7 @@ */ private $writer; - /** -* @param RdfVocabulary $vocabulary -* @param RdfWriter $writer -*/ - public function __construct( - RdfVocabulary $vocabulary, - RdfWriter $writer - ) { + public function __construct( RdfVocabulary $vocabulary, RdfWriter $writer ) { $this->vocabulary = $vocabulary; $this->writer = $writer; } diff --git a/tests/phpunit/composer/DataModel/Services/Diff/FormDifferPatcherTest.php b/tests/phpunit/composer/DataModel/Services/Diff/FormDifferPatcherTest.php index a6aba3c..5d4939e 100644 --- a/tests/phpunit/composer/DataModel/Services/Diff/FormDifferPatcherTest.php +++ b/tests/phpunit/composer/DataModel/Services/Diff/FormDifferPatcherTest.php @@ -163,10 +163,6 @@ $this->assertEquals( [], $form1->getGrammaticalFeatures() ); } - /** -* @param ItemId $gf -* @param Form $form -*/ private function assertHasGrammaticalFeature( ItemId $gf, Form $form ) { $this->assertContains( $gf, @@ -178,10 +174,6 @@ ); } - /** -* @param ItemId $gf -* @param Form $form -*/ private function assertDoentHaveGrammaticalFeature( ItemId $gf, Form $form ) { $this->assertNotContains( $gf, -- To view, visit https://gerrit.wikimedia.org/r/403955 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib4e529310ef66d36b6909fff7d1b07afd53a3fe8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...Wikibase[master]: Improve type hints and remove 100% redundant PHPDoc blocks
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403954 ) Change subject: Improve type hints and remove 100% redundant PHPDoc blocks .. Improve type hints and remove 100% redundant PHPDoc blocks The main reason for this patch are the missing type hints and & I am adding in certain places. I'm also removing PHPDoc block that repeat 100% exactly what the method header already states. We already did this once, that's why only a few of such comment blocks could be found for this patch. Change-Id: I222660937fc7f3ce6a0ea5fbf7198199d6b08bef --- M client/WikibaseClient.hooks.php M client/includes/Changes/InjectRCRecordsJob.php M client/includes/Hooks/ChangesListLinesHandler.php M client/includes/Hooks/NoLangLinkHandler.php M client/includes/Serializer/ClientStatementListSerializer.php M client/includes/Usage/UsageTrackingSnakFormatter.php M lib/includes/Store/CacheRetrievingEntityRevisionLookup.php M lib/includes/Store/CachingEntityRevisionLookup.php M repo/Wikibase.hooks.php M repo/includes/Diff/DispatchingEntityDiffVisualizer.php M repo/includes/EditEntityFactory.php M repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php M repo/includes/WikibaseRepo.php M repo/tests/phpunit/includes/Store/MockEntityIdPager.php 14 files changed, 12 insertions(+), 71 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/54/403954/1 diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index b53ef3c..1176ab4 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -238,7 +238,7 @@ /** * Register the parser functions. * -* @param Parser $parser +* @param Parser &$parser * * @return bool */ diff --git a/client/includes/Changes/InjectRCRecordsJob.php b/client/includes/Changes/InjectRCRecordsJob.php index 545fdd2..021b3ef 100644 --- a/client/includes/Changes/InjectRCRecordsJob.php +++ b/client/includes/Changes/InjectRCRecordsJob.php @@ -159,30 +159,18 @@ $this->logger = new NullLogger(); } - /** -* @param RecentChangesDuplicateDetector $rcDuplicateDetector -*/ public function setRecentChangesDuplicateDetector( RecentChangesDuplicateDetector $rcDuplicateDetector ) { $this->rcDuplicateDetector = $rcDuplicateDetector; } - /** -* @param TitleFactory $titleFactory -*/ public function setTitleFactory( TitleFactory $titleFactory ) { $this->titleFactory = $titleFactory; } - /** -* @param LoggerInterface $logger -*/ public function setLogger( LoggerInterface $logger ) { $this->logger = $logger; } - /** -* @param StatsdDataFactoryInterface $stats -*/ public function setStats( StatsdDataFactoryInterface $stats ) { $this->stats = $stats; } diff --git a/client/includes/Hooks/ChangesListLinesHandler.php b/client/includes/Hooks/ChangesListLinesHandler.php index 73d69c3..fb05c83 100644 --- a/client/includes/Hooks/ChangesListLinesHandler.php +++ b/client/includes/Hooks/ChangesListLinesHandler.php @@ -65,7 +65,7 @@ * @param ChangesList $changesList * @return self */ - private static function getInstance( $changesList ) { + private static function getInstance( ChangesList $changesList ) { if ( self::$instance === null ) { self::$instance = self::newFromGlobalState( $changesList ); } diff --git a/client/includes/Hooks/NoLangLinkHandler.php b/client/includes/Hooks/NoLangLinkHandler.php index 3675d91..f6b8f90 100644 --- a/client/includes/Hooks/NoLangLinkHandler.php +++ b/client/includes/Hooks/NoLangLinkHandler.php @@ -30,7 +30,7 @@ * * @return string */ - public static function handle( &$parser /*...*/ ) { + public static function handle( Parser &$parser /*...*/ ) { $langs = func_get_args(); // Remove the first member, which is the parser. @@ -88,12 +88,12 @@ /** * Parser function * -* @param Parser &$parser +* @param Parser $parser * @param string[] $langs * * @return string */ - public function doHandle( &$parser, array $langs ) { + public function doHandle( Parser $parser, array $langs ) { if ( !$this->namespaceChecker->isWikibaseEnabled( $parser->getTitle()->getNamespace() ) ) { // shorten out return ''; diff --git a/client/includes/Serializer/ClientStatementListSerializer.php b/client/includes/Serializer/ClientStatemen
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityExternalValidation[master]: Improve type hints in CrossCheckerTest and remove redundant ...
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403953 ) Change subject: Improve type hints in CrossCheckerTest and remove redundant PHPDoc .. Improve type hints in CrossCheckerTest and remove redundant PHPDoc The majority of this patch removes PHPDoc blocks that repeat 100% exactly what the method header already states. But this is only minor cleanup and not the meat of this patch. Change-Id: Ie1579418191098f48cca32de941da9bdf6d4c05a --- M includes/CrossCheck/Comparer/DataValueComparerFactory.php M includes/CrossCheck/Comparer/EntityIdValueComparer.php M includes/CrossCheck/Comparer/MonolingualTextValueComparer.php M includes/CrossCheck/Comparer/MultilingualTextValueComparer.php M includes/CrossCheck/Comparer/StringComparer.php M includes/CrossCheck/Comparer/StringValueComparer.php M includes/CrossCheck/CrossCheckInteractor.php M includes/CrossCheck/CrossChecker.php M includes/CrossCheck/ValueParser/MultilingualTextValueParser.php M includes/CrossCheck/ValueParser/StringValueParser.php M includes/DumpMetaInformation/SqlDumpMetaInformationRepo.php M includes/Serializer/ComparisonResultSerializer.php M includes/Serializer/CrossCheckResultListSerializer.php M includes/Serializer/CrossCheckResultSerializer.php M includes/Serializer/ReferenceResultSerializer.php M includes/Serializer/SerializerFactory.php M includes/UpdateExternalData/ExternalDataImporter.php M specials/SpecialCrossCheck.php M specials/SpecialExternalDatabases.php M tests/phpunit/CrossCheck/CrossCheckerTest.php 20 files changed, 17 insertions(+), 97 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation refs/changes/53/403953/1 diff --git a/includes/CrossCheck/Comparer/DataValueComparerFactory.php b/includes/CrossCheck/Comparer/DataValueComparerFactory.php index d510a18..7d98ec5 100644 --- a/includes/CrossCheck/Comparer/DataValueComparerFactory.php +++ b/includes/CrossCheck/Comparer/DataValueComparerFactory.php @@ -22,10 +22,6 @@ */ private $stringNormalizer; - /** -* @param TermIndex $termIndex -* @param StringNormalizer $stringNormalizer -*/ public function __construct( TermIndex $termIndex, StringNormalizer $stringNormalizer ) { $this->termIndex = $termIndex; $this->stringNormalizer = $stringNormalizer; diff --git a/includes/CrossCheck/Comparer/EntityIdValueComparer.php b/includes/CrossCheck/Comparer/EntityIdValueComparer.php index 9eb07a1..3a2fc72 100644 --- a/includes/CrossCheck/Comparer/EntityIdValueComparer.php +++ b/includes/CrossCheck/Comparer/EntityIdValueComparer.php @@ -28,10 +28,6 @@ */ private $stringComparer; - /** -* @param TermIndex $termIndex -* @param StringComparer $stringComparer -*/ public function __construct( TermIndex $termIndex, StringComparer $stringComparer ) { $this->termIndex = $termIndex; $this->stringComparer = $stringComparer; diff --git a/includes/CrossCheck/Comparer/MonolingualTextValueComparer.php b/includes/CrossCheck/Comparer/MonolingualTextValueComparer.php index 29451d4..c64c0cc 100644 --- a/includes/CrossCheck/Comparer/MonolingualTextValueComparer.php +++ b/includes/CrossCheck/Comparer/MonolingualTextValueComparer.php @@ -18,9 +18,6 @@ */ private $stringComparer; - /** -* @param StringComparer $stringComparer -*/ public function __construct( StringComparer $stringComparer ) { $this->stringComparer = $stringComparer; } diff --git a/includes/CrossCheck/Comparer/MultilingualTextValueComparer.php b/includes/CrossCheck/Comparer/MultilingualTextValueComparer.php index bdec056..ae95de4 100644 --- a/includes/CrossCheck/Comparer/MultilingualTextValueComparer.php +++ b/includes/CrossCheck/Comparer/MultilingualTextValueComparer.php @@ -19,9 +19,6 @@ */ private $stringComparer; - /** -* @param StringComparer $stringComparer -*/ public function __construct( StringComparer $stringComparer ) { $this->stringComparer = $stringComparer; } diff --git a/includes/CrossCheck/Comparer/StringComparer.php b/includes/CrossCheck/Comparer/StringComparer.php index cf8464f..4530a03 100644 --- a/includes/CrossCheck/Comparer/StringComparer.php +++ b/includes/CrossCheck/Comparer/StringComparer.php @@ -23,9 +23,6 @@ */ private $stringNormalizer; - /** -* @param StringNormalizer $stringNormalizer -*/ public function __construct( StringNormalizer $stringNormalizer ) { $this->stringNormalizer = $stringNormalizer; } diff --git a/includes/CrossCheck/Comparer/StringValueComparer.php b/includes/CrossCheck/Comparer/StringValueComparer.php index 90
[MediaWiki-commits] [Gerrit] mediawiki...PropertySuggester[master]: Improve type hints in different places
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403951 ) Change subject: Improve type hints in different places .. Improve type hints in different places This patch adds missing type hints both in method headers as well as documentation. I also remove some comment blocks that repeat 100% exactly what the method header itself already states. Change-Id: I44dc9d7fe870a74625bb6498566834a212dcd35b --- M src/GetSuggestions.php M src/Hooks.php M src/ResultBuilder.php M src/Suggesters/SimpleSuggester.php M src/UpdateTable/ImportContext.php 5 files changed, 7 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PropertySuggester refs/changes/51/403951/1 diff --git a/src/GetSuggestions.php b/src/GetSuggestions.php index 303ca58..585a980 100644 --- a/src/GetSuggestions.php +++ b/src/GetSuggestions.php @@ -148,7 +148,7 @@ * @param int $resultSize * @param string $search * @param string $language -* @return array +* @return array[] */ private function querySearchApi( $resultSize, $search, $language ) { $searchEntitiesParameters = new DerivativeRequest( diff --git a/src/Hooks.php b/src/Hooks.php index 15ac2db..8e02888 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -18,8 +18,8 @@ * Handler for the BeforePageDisplay hook, injects special behaviour * for PropertySuggestions in the EntitySuggester (if page is in EntityNamespace) * -* @param OutputPage $out -* @param Skin $skin +* @param OutputPage &$out +* @param Skin &$skin */ public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { if ( $out->getRequest()->getCheck( 'nosuggestions' ) ) { @@ -44,9 +44,6 @@ $out->addModules( 'ext.PropertySuggester.EntitySelector' ); } - /** -* @param DatabaseUpdater $updater -*/ public static function onCreateSchema( DatabaseUpdater $updater ) { $updater->addExtensionTable( 'wbs_propertypairs', diff --git a/src/ResultBuilder.php b/src/ResultBuilder.php index 492ee9f..0b30767 100644 --- a/src/ResultBuilder.php +++ b/src/ResultBuilder.php @@ -91,7 +91,7 @@ private function buildEntry( EntityId $id, array $clusteredTerms, Suggestion $suggestion ) { $entry = [ 'id' => $id->getSerialization(), - 'url' => $this->entityTitleLookup->getTitleForId( $id )->getFullUrl(), + 'url' => $this->entityTitleLookup->getTitleForId( $id )->getFullURL(), 'rating' => $suggestion->getProbability(), ]; diff --git a/src/Suggesters/SimpleSuggester.php b/src/Suggesters/SimpleSuggester.php index e786546..e92c10b 100644 --- a/src/Suggesters/SimpleSuggester.php +++ b/src/Suggesters/SimpleSuggester.php @@ -41,9 +41,6 @@ */ private $lb; - /** -* @param LoadBalancer $lb -*/ public function __construct( LoadBalancer $lb ) { $this->lb = $lb; } diff --git a/src/UpdateTable/ImportContext.php b/src/UpdateTable/ImportContext.php index e4235d0..c62209d 100644 --- a/src/UpdateTable/ImportContext.php +++ b/src/UpdateTable/ImportContext.php @@ -31,7 +31,7 @@ private $targetTableName = ""; /** -* @var LoadBalancer +* @var LoadBalancer|null */ private $lb = null; @@ -60,16 +60,13 @@ } /** -* @return LoadBalancer +* @return LoadBalancer|null */ public function getLb() { return $this->lb; } - /** -* @param LoadBalancer $lb -*/ - public function setLb( $lb ) { + public function setLb( LoadBalancer $lb ) { $this->lb = $lb; } -- To view, visit https://gerrit.wikimedia.org/r/403951 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I44dc9d7fe870a74625bb6498566834a212dcd35b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PropertySuggester Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] operations/mediawiki-config[master]: Remove $wgWBQualityConstraintsIncludeDetailInApi setting
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403939 ) Change subject: Remove $wgWBQualityConstraintsIncludeDetailInApi setting .. Remove $wgWBQualityConstraintsIncludeDetailInApi setting With WikibaseQualityConstraints commit 41c26ca1ef (change I1d8460aa27), the default value of the option was changed to false, so we no longer need to explicitly set it to that. This reverts commit e4c63ff9cd (change I32d679cd5c). Bug: T180614 Change-Id: If8f9a0289edb47d4528f1a086630c2a0cf077fc4 Depends-On: I1d8460aa277b45f3872d5cde82c31277af278592 --- M wmf-config/Wikibase-production.php 1 file changed, 0 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config refs/changes/39/403939/1 diff --git a/wmf-config/Wikibase-production.php b/wmf-config/Wikibase-production.php index 65fe6d0..8e7b216 100644 --- a/wmf-config/Wikibase-production.php +++ b/wmf-config/Wikibase-production.php @@ -169,8 +169,6 @@ 'the Creative Commons CC0 License; text in the other namespaces is available under ' . 'the Creative Commons Attribution-ShareAlike License; additional terms may apply.'; $wgRightsUrl = 'creativecommons.org/licenses/by-sa/3.0'; - - $wgWBQualityConstraintsIncludeDetailInApi = false; // T180614 } if ( $wmgUseWikibaseClient ) { -- To view, visit https://gerrit.wikimedia.org/r/403939 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If8f9a0289edb47d4528f1a086630c2a0cf077fc4 Gerrit-PatchSet: 1 Gerrit-Project: operations/mediawiki-config Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Gradually enable constraints gadget for all users
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403920 ) Change subject: Gradually enable constraints gadget for all users .. Gradually enable constraints gadget for all users Starting 2018-02-28, we enable the constraints gadget for more and more users (selected by the first character of their user name), until by 2018-04-04 it’s enabled for all (logged in) users. Bug: T184069 Change-Id: I6265d4557809926e7f031dd76e6dc60e187d2cff --- M extension.json M src/WikibaseQualityConstraintsHooks.php M tests/phpunit/WikibaseQualityConstraintsHooksTest.php 3 files changed, 103 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/20/403920/1 diff --git a/extension.json b/extension.json index 7e5c26b..661e407 100644 --- a/extension.json +++ b/extension.json @@ -21,7 +21,8 @@ "Hooks": { "LoadExtensionSchemaUpdates": "WikibaseQuality\\ConstraintReport\\WikibaseQualityConstraintsHooks::onCreateSchema", "WikibaseChangeNotification": "WikibaseQuality\\ConstraintReport\\WikibaseQualityConstraintsHooks::onWikibaseChange", - "ArticlePurge": "WikibaseQuality\\ConstraintReport\\WikibaseQualityConstraintsHooks::onArticlePurge" + "ArticlePurge": "WikibaseQuality\\ConstraintReport\\WikibaseQualityConstraintsHooks::onArticlePurge", + "BeforePageDisplay": "WikibaseQuality\\ConstraintReport\\WikibaseQualityConstraintsHooks::onBeforePageDisplay" }, "SpecialPages": { "ConstraintReport": "WikibaseQuality\\ConstraintReport\\Specials\\SpecialConstraintReport::newFromGlobalState" diff --git a/src/WikibaseQualityConstraintsHooks.php b/src/WikibaseQualityConstraintsHooks.php index e24a3c8..1dd1de7 100644 --- a/src/WikibaseQualityConstraintsHooks.php +++ b/src/WikibaseQualityConstraintsHooks.php @@ -7,6 +7,8 @@ use JobQueueGroup; use JobSpecification; use MediaWiki\MediaWikiServices; +use OutputPage; +use Skin; use Title; use Wikibase\Change; use Wikibase\DataModel\Entity\PropertyId; @@ -81,4 +83,59 @@ } } + /** +* @param string $userName +* @param int $timestamp UTC timestamp (seconds since the Epoch) +* @return bool +*/ + public static function isGadgetEnabledForUserName( $userName, $timestamp ) { + $initial = $userName[0]; + + if ( $initial === 'Z' ) { + $firstWeek = 0; + } elseif ( $initial >= 'W' && $initial < 'Z' ) { + $firstWeek = 1; + } elseif ( $initial >= 'T' && $initial < 'W' ) { + $firstWeek = 2; + } elseif ( $initial >= 'N' && $initial < 'T' ) { + $firstWeek = 3; + } elseif ( $initial >= 'E' && $initial < 'N' ) { + $firstWeek = 4; + } else { + $firstWeek = 5; + } + + $threshold = gmmktime( + 0, // hour + 0, // minute + 0, // second + 3, // month; overflows to 3 or 4 depending on day + $firstWeek * 7 + 1, // day + 2018 // year + ); + + return $timestamp >= $threshold; + } + + public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { + $repo = WikibaseRepo::getDefaultInstance(); + + $lookup = $repo->getEntityNamespaceLookup(); + $title = $out->getTitle(); + if ( $title === null ) { + return; + } + + if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) { + return; + } + if ( !$out->getUser()->isLoggedIn() ) { + return; + } + + if ( self::isGadgetEnabledForUserName( $out->getUser()->getName(), time() ) ) { + $out->addModules( 'wikibase.quality.constraints.gadget' ); + } + } + } diff --git a/tests/phpunit/WikibaseQualityConstraintsHooksTest.php b/tests/phpunit/WikibaseQualityConstraintsHooksTest.php index 4df2606..9c3c6d4 100644 --- a/tests/phpunit/WikibaseQualityConstraintsHooksTest.php +++ b/tests/phpunit/WikibaseQualityConstraintsHooksTest.php @@ -104,4 +104,48 @@ yield &
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseQualityConstraints[master]: Don’t hide default [Expand] link
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403736 ) Change subject: Don’t hide default [Expand] link .. Don’t hide default [Expand] link Wikibase’s fancy icon on collapsibles no longer applies to us as of I6713bdf4c4, so if we hide MediaWiki’s link we see nothing at all. Perhaps we can restore the prettier Wikibase version at some point, but for now let’s make sure we at least have *something*. Change-Id: I73e39c075e5018eb1af09d5336b44c7613128b47 --- M modules/ui/ConstraintReportGroup.less 1 file changed, 0 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints refs/changes/36/403736/1 diff --git a/modules/ui/ConstraintReportGroup.less b/modules/ui/ConstraintReportGroup.less index 9820407..1e3fec0 100644 --- a/modules/ui/ConstraintReportGroup.less +++ b/modules/ui/ConstraintReportGroup.less @@ -1,8 +1,3 @@ -.wikibase-toolbar-item .mw-collapsible-toggle * { - /* wikibase CSS adds an icon, so hide the normal [expand] link */ - display: none; -} - .wbqc-reports-all .wbqc-reports:not( :first-child ) { /* add some space between groups in a list */ margin-top: 1em; -- To view, visit https://gerrit.wikimedia.org/r/403736 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73e39c075e5018eb1af09d5336b44c7613128b47 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: Add revision ID to the response of edit form elements API
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403716 ) Change subject: Add revision ID to the response of edit form elements API .. Add revision ID to the response of edit form elements API Bug: T184409 Change-Id: I5421bd160125158251de4489acf1c06b84e889dd --- M src/Api/EditFormElements.php M tests/phpunit/mediawiki/Api/EditFormElementsTest.php 2 files changed, 39 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/16/403716/1 diff --git a/src/Api/EditFormElements.php b/src/Api/EditFormElements.php index 5eb2068..fb52f5e 100644 --- a/src/Api/EditFormElements.php +++ b/src/Api/EditFormElements.php @@ -117,7 +117,7 @@ $this->dieStatus( $status ); } - $this->generateResponse( $form ); + $this->generateResponse( $form, $status ); } /** @@ -157,15 +157,19 @@ /** * @param Form $form */ - private function generateResponse( Form $form ) { + private function generateResponse( Form $form, \Status $status ) { $apiResult = $this->getResult(); $serializedForm = $this->formSerializer->serialize( $form ); unset( $serializedForm['claims'] ); + $statusValue = $status->getValue(); + $revisionId = $statusValue['revision']->getRevisionId(); + // TODO: Do we really need `success` property in response? $apiResult->addValue( null, 'success', 1 ); $apiResult->addValue( null, 'form', $serializedForm ); + $apiResult->addValue( null, 'lastrevid', $revisionId ); } /** diff --git a/tests/phpunit/mediawiki/Api/EditFormElementsTest.php b/tests/phpunit/mediawiki/Api/EditFormElementsTest.php index b6e3fb7..ea8a319 100644 --- a/tests/phpunit/mediawiki/Api/EditFormElementsTest.php +++ b/tests/phpunit/mediawiki/Api/EditFormElementsTest.php @@ -10,6 +10,7 @@ use Wikibase\Lexeme\DataModel\LexemeId; use Wikibase\Lexeme\Tests\DataModel\NewForm; use Wikibase\Lexeme\Tests\DataModel\NewLexeme; +use Wikibase\Lib\Store\EntityRevision; use Wikibase\Repo\Tests\Api\WikibaseApiTestCase; use Wikibase\Repo\WikibaseRepo; @@ -354,7 +355,27 @@ ); } - // TODO: test API response contains the revision ID + public function testGivenFormEdited_responseContainsRevisionId() { + $form = NewForm::havingId( 'F1' ) + ->andGrammaticalFeature( 'Q123' ) + ->andRepresentation( 'en', 'goat' ) + ->build(); + $lexeme = NewLexeme::havingId( 'L1' )->withForm( $form )->build(); + + $this->saveLexeme( $lexeme ); + + $params = [ + 'action' => 'wblexemeeditformelements', + 'formId' => 'L1-F1', + 'data' => $this->getDataParam() + ]; + + list( $result, ) = $this->doApiRequestWithToken( $params ); + + $lexemeRevision = $this->getCurrentRevisionForForm( 'L1-F1' ); + + $this->assertEquals( $lexemeRevision->getRevisionId(), $result['lastrevid'] ); + } private function saveLexeme( Lexeme $lexeme ) { $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); @@ -372,4 +393,15 @@ return $lookup->getEntity( new LexemeId( $id ) ); } + /** +* @param string $id +* +* @return EntityRevision|null +*/ + private function getCurrentRevisionForForm( $id ) { + $lookup = WikibaseRepo::getDefaultInstance()->getEntityRevisionLookup(); + + return $lookup->getEntityRevision( new FormId( $id ) ); + } + } -- To view, visit https://gerrit.wikimedia.org/r/403716 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5421bd160125158251de4489acf1c06b84e889dd Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: WMDE-leszek ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Improve PARAM_HELP_MSG_PER_VALUE documentation
Lucas Werkmeister (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403707 ) Change subject: Improve PARAM_HELP_MSG_PER_VALUE documentation .. Improve PARAM_HELP_MSG_PER_VALUE documentation Per-value documentation is only generated if this option is specified, even if it is only set to an empty array (i. e., when using the default key for all values). Attempt to make this more clear. Change-Id: I844df226271aadb1f06b3cc00ba32cc6c06ec76a --- M includes/api/ApiBase.php 1 file changed, 1 insertion(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/07/403707/1 diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 83d2ae9..6ff4eed 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -155,6 +155,7 @@ * ((string|array|Message)[]) When PARAM_TYPE is an array, this is an array * mapping those values to $msg for ApiBase::makeMessage(). Any value not * having a mapping will use apihelp-{$path}-paramvalue-{$param}-{$value}. +* (Specify an empty array to use that default message key for all values.) * @since 1.25 */ const PARAM_HELP_MSG_PER_VALUE = 14; -- To view, visit https://gerrit.wikimedia.org/r/403707 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I844df226271aadb1f06b3cc00ba32cc6c06ec76a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Lucas Werkmeister (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: Rename $wp variables to $wikiPage
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403669 ) Change subject: Rename $wp variables to $wikiPage .. Rename $wp variables to $wikiPage Same as I450cfea was for $sk variables. Change-Id: I295b4c9d181a65ad8ac2393e764b544754d5a698 --- M includes/api/ApiMobileView.php M tests/phpunit/api/ApiMobileViewTest.php 2 files changed, 29 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/69/403669/1 diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php index 51448b9..e0720d3 100644 --- a/includes/api/ApiMobileView.php +++ b/includes/api/ApiMobileView.php @@ -333,8 +333,8 @@ */ protected function isMainPage( $title ) { if ( $title->isRedirect() && $this->followRedirects ) { - $wp = $this->makeWikiPage( $title ); - $target = $wp->getRedirectTarget(); + $wikiPage = $this->makeWikiPage( $title ); + $target = $wikiPage->getRedirectTarget(); if ( $target ) { return $target->isMainPage(); } @@ -444,14 +444,18 @@ /** * Performs a page parse -* @param WikiPage $wp Wiki page object +* @param WikiPage $wikiPage Wiki page object * @param ParserOptions $parserOptions Options for parser * @param null|int $oldid Revision ID to get the text from, passing null or 0 will * get the current revision (default value) * @return ParserOutput|null */ - protected function getParserOutput( WikiPage $wp, ParserOptions $parserOptions, $oldid = null ) { - $parserOutput = $wp->getParserOutput( $parserOptions, $oldid ); + protected function getParserOutput( + WikiPage $wikiPage, + ParserOptions $parserOptions, + $oldid = null + ) { + $parserOutput = $wikiPage->getParserOutput( $parserOptions, $oldid ); if ( $parserOutput && !defined( 'ParserOutput::SUPPORTS_STATELESS_TRANSFORMS' ) ) { $parserOutput->setTOCEnabled( false ); } @@ -544,9 +548,9 @@ $mfSpecialCaseMainPage = $mfConfig->get( 'MFSpecialCaseMainPage' ); $result = $this->getResult(); - $wp = $this->makeWikiPage( $title ); - if ( $this->followRedirects && $wp->isRedirect() ) { - $newTitle = $wp->getRedirectTarget(); + $wikiPage = $this->makeWikiPage( $title ); + if ( $this->followRedirects && $wikiPage->isRedirect() ) { + $newTitle = $wikiPage->getRedirectTarget(); if ( $newTitle ) { $title = $newTitle; $textTitle = $title->getPrefixedText(); @@ -562,12 +566,12 @@ ); return []; } - $wp = $this->makeWikiPage( $title ); + $wikiPage = $this->makeWikiPage( $title ); } } - $latest = $wp->getLatest(); + $latest = $wikiPage->getLatest(); // Use page_touched so template updates invalidate cache - $touched = $wp->getTouched(); + $touched = $wikiPage->getTouched(); $revId = $oldid ? $oldid : $title->getLatestRevID(); if ( $this->file ) { $key = $wgMemc->makeKey( @@ -587,9 +591,9 @@ // Title::exists() above doesn't seem to always catch recently deleted pages $this->dieWithError( [ 'apierror-missingtitle' ] ); } - $parserOptions = $this->makeParserOptions( $wp ); - $parserCacheKey = \MediaWiki\MediaWikiServices::getInstance()->getParserCache()->getKey( $wp, - $parserOptions ); + $parserOptions = $this->makeParserOptions( $wikiPage ); + $parserCache = \MediaWiki\MediaWikiServices::getInstance()->getParserCache(); + $parserCacheKey = $parserCache->getKey( $wikiPage, $parserOptions ); $key = $wgMemc->makeKey( 'mf', 'mobileview', @@ -610,7 +614,7 @@
[MediaWiki-commits] [Gerrit] mediawiki...WikibaseLexeme[master]: [WIP] Save changes to the form elements made in the UI
WMDE-leszek has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403665 ) Change subject: [WIP] Save changes to the form elements made in the UI .. [WIP] Save changes to the form elements made in the UI TODO: - update the "form revision id" after the save - browser test (for a single case at least) Bug: T184411 Change-Id: I06776c59169f711fc7a6b2bcb00d2eb470dcc078 --- M resources/entityChangers/FormChanger.js 1 file changed, 24 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/65/403665/1 diff --git a/resources/entityChangers/FormChanger.js b/resources/entityChangers/FormChanger.js index c84a3dc..2292bac 100644 --- a/resources/entityChangers/FormChanger.js +++ b/resources/entityChangers/FormChanger.js @@ -49,10 +49,6 @@ lexemeDeserializer = new wb.lexeme.serialization.LexemeDeserializer(), self = this; - if ( form.getId() ) { - return $.Deferred().resolve( form ).promise();// TODO: implement edit form - } - var serializedForm = formSerializer.serialize( form ); var representations = []; for ( var languageKey in serializedForm.representations ) { @@ -61,13 +57,36 @@ } } + if ( form.getId() ) { + return this.api.postWithToken( 'csrf', { + action: 'wblexemeeditformelements', + formId: form.getId(), + data: JSON.stringify( { + representations: representations, + grammaticalFeatures: serializedForm.grammaticalFeatures + } ), + errorformat: 'plaintext', + bot: 1 + } ).then( function ( data ) { + var form = lexemeDeserializer.deserializeForm( data.form ); + // TODO: lastrevid needed in the API response (for the statement widget) + //self.revisionStore.setFormRevision( data.lastrevid, form.getId() ); + return form; + } ).catch( function ( code, response ) { + throw convertPlainTextErrorsToRepoApiError( response.errors ); + } ); + } + serializedForm.representations = representations; delete serializedForm[ 'id' ]; return this.api.postWithToken( 'csrf', { action: 'wblexemeaddform', lexemeId: this.lexemeId, - data: JSON.stringify( serializedForm ), + data: JSON.stringify( { + representations: representations, + grammaticalFeatures: serializedForm.grammaticalFeatures + } ), errorformat: 'plaintext', bot: 1 } ).then( function ( data ) { -- To view, visit https://gerrit.wikimedia.org/r/403665 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I06776c59169f711fc7a6b2bcb00d2eb470dcc078 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: WMDE-leszek ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Update UserSaveOptions/UserSaveSettings hook descriptions
Thiemo Kreuz (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/403662 ) Change subject: Update UserSaveOptions/UserSaveSettings hook descriptions .. Update UserSaveOptions/UserSaveSettings hook descriptions I already updated https://www.mediawiki.org/wiki/Manual:Hooks/UserSaveOptions https://www.mediawiki.org/wiki/Manual:Hooks/UserSaveSettings accordingly. Change-Id: I492f83aa8acb6521f3e175fdbf507a7e44491ca2 --- M docs/hooks.txt 1 file changed, 9 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/62/403662/1 diff --git a/docs/hooks.txt b/docs/hooks.txt index 2c6fc02..5b4de7f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3803,12 +3803,16 @@ $add: Array of strings corresponding to groups added $remove: Array of strings corresponding to groups removed -'UserSaveOptions': Called just before saving user preferences/options. -$user: User object -&$options: Options, modifiable +'UserSaveOptions': Called just before saving user preferences. Hook handlers can either add or +manipulate options, or reset one back to it's default to block changing it. Hook handlers are also +allowed to abort the process by returning false, e.g. to save to a global profile instead. Compare +to the UserSaveSettings hook, which is called after the preferences have been saved. +$user: The User for which the options are going to be saved +&$options: The users options as an associative array, modifiable -'UserSaveSettings': Called when saving user settings. -$user: User object +'UserSaveSettings': Called directly after user preferences (user_properties in the database) have +been saved. Compare to the UserSaveOptions hook, which is called before. +$user: The User for which the options have been saved 'UserSetCookies': DEPRECATED! If you're trying to replace core session cookie handling, you want to create a subclass of MediaWiki\Session\CookieSessionProvider -- To view, visit https://gerrit.wikimedia.org/r/403662 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I492f83aa8acb6521f3e175fdbf507a7e44491ca2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Thiemo Kreuz (WMDE) ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits