jenkins-bot has submitted this change and it was merged. Change subject: New Wikidata Build - 2016-12-01T10:00:01+0000 ......................................................................
New Wikidata Build - 2016-12-01T10:00:01+0000 Change-Id: I2a3314c8c2a795309dde7661dcc28b32d555ef2f --- M composer.lock M extensions/ArticlePlaceholder/includes/specials/SpecialAboutTopic.php M extensions/Wikibase/client/i18n/diq.json M extensions/Wikibase/client/i18n/udm.json M extensions/Wikibase/composer.json M extensions/Wikibase/lib/i18n/eu.json A extensions/Wikibase/lib/includes/Interactors/DispatchingTermSearchInteractor.php M extensions/Wikibase/lib/includes/Interactors/TermSearchResult.php M extensions/Wikibase/lib/includes/Store/Sql/TermSqlIndex.php A extensions/Wikibase/lib/tests/phpunit/Interactors/DispatchingTermSearchInteractorTest.php M extensions/Wikibase/lib/tests/phpunit/Interactors/TermSearchResultTest.php M extensions/Wikibase/lib/tests/phpunit/Store/Sql/TermSqlIndexTest.php M extensions/Wikibase/repo/i18n/azb.json M extensions/Wikibase/repo/i18n/pt.json M extensions/Wikibase/repo/i18n/udm.json D extensions/Wikibase/repo/tests/browser A extensions/Wikibase/repo/tests/browser M extensions/Wikibase/view/resources/jquery/wikibase/toolbar/jquery.wikibase.toolbar.js M extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbar.css M extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbarbutton.css M extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbaritem.css M vendor/composer/LICENSE M vendor/composer/autoload_classmap.php M vendor/composer/installed.json M vendor/wikibase/data-model/RELEASE-NOTES.md M vendor/wikibase/data-model/src/Entity/Int32EntityId.php M vendor/wikibase/data-model/src/Entity/ItemId.php M vendor/wikibase/data-model/src/Entity/PropertyId.php M vendor/wikibase/data-model/tests/unit/Entity/ItemIdTest.php M vendor/wikibase/data-model/tests/unit/Entity/PropertyIdTest.php 30 files changed, 751 insertions(+), 345 deletions(-) Approvals: Aude: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.lock b/composer.lock index 01d52f4..07d62f6 100644 --- a/composer.lock +++ b/composer.lock @@ -797,12 +797,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git", - "reference": "16994f2031c33dba11ca997283397397ac313a28" + "reference": "197aabc07ea2f998079b0268c6b56eb2947a0269" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/16994f2031c33dba11ca997283397397ac313a28", - "reference": "16994f2031c33dba11ca997283397397ac313a28", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/197aabc07ea2f998079b0268c6b56eb2947a0269", + "reference": "197aabc07ea2f998079b0268c6b56eb2947a0269", "shasum": "" }, "require-dev": { @@ -827,7 +827,7 @@ ], "description": "Provides a special page with Wikibase information about a certain topic, with invitation to create an article for the topic", "homepage": "https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder", - "time": "2016-11-30 11:53:18" + "time": "2016-11-30 14:30:13" }, { "name": "propertysuggester/property-suggester", @@ -1040,16 +1040,16 @@ }, { "name": "wikibase/data-model", - "version": "6.3.0", + "version": "6.3.1", "source": { "type": "git", "url": "https://github.com/wmde/WikibaseDataModel.git", - "reference": "da73698973282d7cc177faf8995bf5d7e526b859" + "reference": "c16667e30b8c3e98573779b46f7099e55021d5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wmde/WikibaseDataModel/zipball/da73698973282d7cc177faf8995bf5d7e526b859", - "reference": "da73698973282d7cc177faf8995bf5d7e526b859", + "url": "https://api.github.com/repos/wmde/WikibaseDataModel/zipball/c16667e30b8c3e98573779b46f7099e55021d5e2", + "reference": "c16667e30b8c3e98573779b46f7099e55021d5e2", "shasum": "" }, "require": { @@ -1097,7 +1097,7 @@ "wikibase", "wikidata" ], - "time": "2016-11-03 17:28:04" + "time": "2016-11-30 16:04:13" }, { "name": "wikibase/data-model-javascript", @@ -1585,12 +1585,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "c7fa54a43b3375770a97e93e6a1c539ffe940edc" + "reference": "fac6549d01e069a7b86f8bc59d2e55bc61f6410a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/c7fa54a43b3375770a97e93e6a1c539ffe940edc", - "reference": "c7fa54a43b3375770a97e93e6a1c539ffe940edc", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/fac6549d01e069a7b86f8bc59d2e55bc61f6410a", + "reference": "fac6549d01e069a7b86f8bc59d2e55bc61f6410a", "shasum": "" }, "require": { @@ -1607,7 +1607,7 @@ "data-values/value-view": "~0.18.0", "diff/diff": "~2.0", "php": ">=5.5.0", - "wikibase/data-model": "~6.3", + "wikibase/data-model": "^6.3.1", "wikibase/data-model-javascript": "~3.0.0", "wikibase/data-model-serialization": "~2.2", "wikibase/data-model-services": "~3.7", @@ -1662,7 +1662,7 @@ "wikibaserepo", "wikidata" ], - "time": "2016-11-30 13:52:49" + "time": "2016-11-30 21:22:39" }, { "name": "wikibase/wikimedia-badges", diff --git a/extensions/ArticlePlaceholder/includes/specials/SpecialAboutTopic.php b/extensions/ArticlePlaceholder/includes/specials/SpecialAboutTopic.php index 675261f..fbdf875 100644 --- a/extensions/ArticlePlaceholder/includes/specials/SpecialAboutTopic.php +++ b/extensions/ArticlePlaceholder/includes/specials/SpecialAboutTopic.php @@ -27,7 +27,7 @@ $settings = $wikibaseClient->getSettings(); // TODO: Remove the feature flag when not needed any more! - $settings->setSetting( 'enableStatementsParserFunction', true ); + $settings->setSetting( 'enableLuaEntityFormatStatements', true ); return new self( new AboutTopicRenderer( diff --git a/extensions/Wikibase/client/i18n/diq.json b/extensions/Wikibase/client/i18n/diq.json index bf3adc8..b7e61df 100644 --- a/extensions/Wikibase/client/i18n/diq.json +++ b/extensions/Wikibase/client/i18n/diq.json @@ -22,7 +22,7 @@ "wikibase-comment-multi": "$1 {{PLURAL:$1|vurnayış|vurnayışi}}", "wikibase-dataitem": "Unsurê {{WBREPONAME}}", "wikibase-editlinks": "Gıreyan bıvurne", - "wikibase-editlinkstitle": "Gıreyanê miyanzıwani bıvurne", + "wikibase-editlinkstitle": "Gıreyanê zıwanmiyanan bıvurne", "wikibase-linkitem-addlinks": "Gıreyan cı ke", "wikibase-linkitem-title": "Pele rê gıre", "wikibase-linkitem-linkpage": "Pele rê gıre", diff --git a/extensions/Wikibase/client/i18n/udm.json b/extensions/Wikibase/client/i18n/udm.json index b1ff476..bb75028 100644 --- a/extensions/Wikibase/client/i18n/udm.json +++ b/extensions/Wikibase/client/i18n/udm.json @@ -13,6 +13,7 @@ "wikibase-editlinks": "Чӧлсконъёсыз тупатыны", "wikibase-editlinkstitle": "Кылъёс куспын чӧлсконъёсыз тупатыны", "wikibase-rc-hide-wikidata": "$1 {{WBREPONAME}}", + "wikibase-rc-hide-wikidata-hide": "Ватыны", "wikibase-rc-hide-wikidata-show": "Возьматыны", "wikibase-rc-wikibase-edit-letter": "д", "wikibase-rc-wikibase-edit-title": "{{grammar:genitive|{{WBREPONAME}}}} тупатон", diff --git a/extensions/Wikibase/composer.json b/extensions/Wikibase/composer.json index 020289a..e97325d 100644 --- a/extensions/Wikibase/composer.json +++ b/extensions/Wikibase/composer.json @@ -33,7 +33,7 @@ "data-values/serialization": "~1.1", "data-values/javascript": "~0.8.3", "data-values/value-view": "~0.18.0", - "wikibase/data-model": "~6.3", + "wikibase/data-model": "^6.3.1", "wikibase/data-model-serialization": "~2.2", "wikibase/internal-serialization": "~2.3", "wikibase/data-model-services": "~3.7", diff --git a/extensions/Wikibase/lib/i18n/eu.json b/extensions/Wikibase/lib/i18n/eu.json index e5dbe20..6f13531 100644 --- a/extensions/Wikibase/lib/i18n/eu.json +++ b/extensions/Wikibase/lib/i18n/eu.json @@ -7,9 +7,9 @@ ] }, "specialpages-group-wikibase": "Wikibase", - "wikibase-deletedentity-item": "Ezabatu elementua", - "wikibase-deletedentity-property": "Ezabatu propietatea", - "wikibase-deletedentity-query": "Ezabatu kontsulta", + "wikibase-deletedentity-item": "Elementu ezabatua", + "wikibase-deletedentity-property": "Propietate ezabatua", + "wikibase-deletedentity-query": "Kontsulta ezabatua", "wikibase-error-save-generic": "Errore baten ondorioz ezin izan dira aldaketak gorde.", "wikibase-language-fallback-transliteration-hint": "$1 (transliteratuta)", "wikibase-timedetails-timezone": "Ordu-eremua", diff --git a/extensions/Wikibase/lib/includes/Interactors/DispatchingTermSearchInteractor.php b/extensions/Wikibase/lib/includes/Interactors/DispatchingTermSearchInteractor.php new file mode 100644 index 0000000..8e551d0 --- /dev/null +++ b/extensions/Wikibase/lib/includes/Interactors/DispatchingTermSearchInteractor.php @@ -0,0 +1,62 @@ +<?php + +namespace Wikibase\Lib\Interactors; + +use Wikimedia\Assert\Assert; +use Wikimedia\Assert\ParameterAssertionException; + +/** + * Picks a TermSearchInteractor configured for the particular entity type when searching for entities. + * + * @license GPL-2.0+ + * + * TODO: rename to DispatchingByEntityTypeTermSearchInteractor ? + */ +class DispatchingTermSearchInteractor implements TermSearchInteractor { + + /** + * @var TermSearchInteractor[] + */ + private $interactors = []; + + /** + * @param TermSearchInteractor[] $interactors Associative array mapping entity types (strings) to TermSearchInteractor instances + * + * @throws ParameterAssertionException + */ + public function __construct( array $interactors ) { + Assert::parameterElementType( TermSearchInteractor::class, $interactors, '$interactors' ); + Assert::parameterElementType( 'string', array_keys( $interactors ), 'array_keys( $interactors )' ); + $this->interactors = $interactors; + } + + /** + * @see TermSearchInteractor::searchForEntities + * + * @param string $text + * @param string $languageCode + * @param string $entityType + * @param string[] $termTypes + * + * @return TermSearchResult[] Returns an empty array also when there is no TermSearchInteractor configured for $entityType + */ + public function searchForEntities( $text, $languageCode, $entityType, array $termTypes ) { + $interactor = $this->getInteractorForEntityType( $entityType ); + + if ( $interactor === null ) { + return []; + } + + return $interactor->searchForEntities( $text, $languageCode, $entityType, $termTypes ); + } + + /** + * @param string $entityType + * + * @return TermSearchInteractor|null + */ + private function getInteractorForEntityType( $entityType ) { + return isset( $this->interactors[$entityType] ) ? $this->interactors[$entityType] : null; + } + +} diff --git a/extensions/Wikibase/lib/includes/Interactors/TermSearchResult.php b/extensions/Wikibase/lib/includes/Interactors/TermSearchResult.php index c9f0977..fbf2338 100644 --- a/extensions/Wikibase/lib/includes/Interactors/TermSearchResult.php +++ b/extensions/Wikibase/lib/includes/Interactors/TermSearchResult.php @@ -82,6 +82,13 @@ } /** + * @return string + */ + public function getRepositoryName() { + return $this->entityId->getRepositoryName(); + } + + /** * @return Term|null */ public function getDisplayLabel() { diff --git a/extensions/Wikibase/lib/includes/Store/Sql/TermSqlIndex.php b/extensions/Wikibase/lib/includes/Store/Sql/TermSqlIndex.php index ffe5c2f..bb0db89 100644 --- a/extensions/Wikibase/lib/includes/Store/Sql/TermSqlIndex.php +++ b/extensions/Wikibase/lib/includes/Store/Sql/TermSqlIndex.php @@ -7,6 +7,7 @@ use InvalidArgumentException; use MWException; use Traversable; +use Wikibase\DataModel\Assert\RepositoryNameAssert; use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Int32EntityId; @@ -37,6 +38,11 @@ /** * @var string */ + private $repositoryName; + + /** + * @var string + */ private $tableName; /** @@ -60,9 +66,17 @@ * @param StringNormalizer $stringNormalizer * @param EntityIdComposer $entityIdComposer * @param string|bool $wikiDb + * @param string $repositoryName */ - public function __construct( StringNormalizer $stringNormalizer, EntityIdComposer $entityIdComposer, $wikiDb = false ) { + public function __construct( + StringNormalizer $stringNormalizer, + EntityIdComposer $entityIdComposer, + $wikiDb = false, + $repositoryName = '' + ) { + RepositoryNameAssert::assertParameterIsValidRepositoryName( $repositoryName, '$repositoryName' ); parent::__construct( $wikiDb ); + $this->repositoryName = $repositoryName; $this->stringNormalizer = $stringNormalizer; $this->entityIdComposer = $entityIdComposer; $this->tableName = 'wb_terms'; @@ -89,16 +103,21 @@ * declared by the TermIndexEntry::TYPE_... constants. * * @throws InvalidArgumentException when $entity does not have an ID. + * @throws MWException + * * @return bool Success indicator */ public function saveTermsOfEntity( EntityDocument $entity ) { - if ( $entity->getId() === null ) { + $entityId = $entity->getId(); + if ( $entityId === null ) { throw new InvalidArgumentException( '$entity must have an ID' ); } + $this->assertEntityIdFromRightRepository( $entityId ); + //First check whether there's anything to update $newTerms = $this->getEntityTerms( $entity ); - $oldTerms = $this->getTermsOfEntity( $entity->getId() ); + $oldTerms = $this->getTermsOfEntity( $entityId ); $termsToInsert = array_udiff( $newTerms, $oldTerms, 'Wikibase\TermIndexEntry::compare' ); $termsToDelete = array_udiff( $oldTerms, $newTerms, 'Wikibase\TermIndexEntry::compare' ); @@ -127,6 +146,32 @@ } /** + * @param EntityId $entityId + * + * @throws MWException + */ + private function assertEntityIdFromRightRepository( EntityId $entityId ) { + if ( $entityId->getRepositoryName() !== $this->repositoryName ) { + throw new MWException( + 'Entity ID: ' . $entityId->getSerialization() . ' does not belong to repository: ' . $this->repositoryName + ); + } + } + + /** + * @param EntityId $entityId + * + * @throws MWException + */ + private function assertIsNumericEntityId( EntityId $entityId ) { + if ( !( $entityId instanceof Int32EntityId ) ) { + throw new MWException( + 'Entity ID: ' . $entityId->getSerialization() . ' does not implement Int32EntityId' + ); + } + } + + /** * @param EntityDocument $entity * @param TermIndexEntry[] $terms * @param Database $dbw @@ -134,9 +179,13 @@ * @return bool Success indicator */ private function insertTerms( EntityDocument $entity, array $terms, Database $dbw ) { + $entityId = $entity->getId(); + $this->assertIsNumericEntityId( $entityId ); + /** @var Int32EntityId $entityId */ + $entityIdentifiers = array( // FIXME: this will fail for IDs that do not have a numeric form - 'term_entity_id' => $entity->getId()->getNumericId(), + 'term_entity_id' => $entityId->getNumericId(), 'term_entity_type' => $entity->getType(), 'term_weight' => $this->getWeight( $entity ), ); @@ -167,14 +216,12 @@ * @param EntityDocument $entity * * @return TermIndexEntry[] + * @throws MWException */ public function getEntityTerms( EntityDocument $entity ) { $id = $entity->getId(); - - if ( !( $id instanceof Int32EntityId ) ) { - wfWarn( 'Entity type "' . $entity->getType() . '" does not implement Int32EntityId' ); - return []; - } + $this->assertEntityIdFromRightRepository( $id ); + $this->assertIsNumericEntityId( $id ); $terms = []; @@ -262,6 +309,8 @@ //TODO: Make getTermsOfEntity() collect term_row_id values, so we can use them here. // That would allow us to do the deletion in a single query, based on a set of ids. + $this->assertIsNumericEntityId( $entityId ); + $entityIdentifiers = array( // FIXME: this will fail for IDs that do not have a numeric form 'term_entity_id' => $entityId->getNumericId(), @@ -347,6 +396,9 @@ * @return bool Success indicator */ public function deleteTermsOfEntity( EntityId $entityId ) { + $this->assertEntityIdFromRightRepository( $entityId ); + $this->assertIsNumericEntityId( $entityId ); + $dbw = $this->getConnection( DB_MASTER ); $success = $dbw->delete( @@ -370,20 +422,21 @@ * Returns the terms stored for the given entity. * * @see TermIndex::getTermsOfEntity - * @todo: share more code with getTermsOfEntities. There are only subtle differences - * regarding what fields are loaded. * * @param EntityId $entityId * @param string[]|null $termTypes * @param string[]|null $languageCodes * * @return TermIndexEntry[] + * @throws MWException */ public function getTermsOfEntity( EntityId $entityId, array $termTypes = null, array $languageCodes = null ) { + $this->assertEntityIdFromRightRepository( $entityId ); + return $this->getTermsOfEntities( array( $entityId ), $termTypes, @@ -408,6 +461,10 @@ array $termTypes = null, array $languageCodes = null ) { + foreach ( $entityIds as $id ) { + $this->assertEntityIdFromRightRepository( $id ); + } + return $this->fetchTerms( $entityIds, $termTypes, $languageCodes ); } @@ -440,6 +497,8 @@ } elseif ( $id->getEntityType() !== $entityType ) { throw new MWException( "ID $id does not refer to an entity of type $entityType" ); } + + $this->assertIsNumericEntityId( $id ); // FIXME: this will fail for IDs that do not have a numeric form $numericIds[] = $id->getNumericId(); @@ -769,7 +828,7 @@ private function getEntityId( $termRow ) { if ( isset( $termRow->term_entity_type ) && isset( $termRow->term_entity_id ) ) { return $this->entityIdComposer->composeEntityId( - '', + $this->repositoryName, $termRow->term_entity_type, $termRow->term_entity_id ); diff --git a/extensions/Wikibase/lib/tests/phpunit/Interactors/DispatchingTermSearchInteractorTest.php b/extensions/Wikibase/lib/tests/phpunit/Interactors/DispatchingTermSearchInteractorTest.php new file mode 100644 index 0000000..af7131f --- /dev/null +++ b/extensions/Wikibase/lib/tests/phpunit/Interactors/DispatchingTermSearchInteractorTest.php @@ -0,0 +1,130 @@ +<?php + +namespace Wikibase\Test\Interactors; + +use PHPUnit_Framework_TestCase; +use Wikibase\DataModel\Entity\ItemId; +use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Term\Term; +use Wikibase\Lib\Interactors\DispatchingTermSearchInteractor; +use Wikibase\Lib\Interactors\TermSearchInteractor; +use Wikibase\Lib\Interactors\TermSearchResult; +use Wikibase\TermIndexEntry; +use Wikimedia\Assert\ParameterAssertionException; + +/** + * @covers Wikibase\Lib\Interactors\DispatchingTermSearchInteractor + * + * @group Wikibase + * @group WikibaseLib + * + * @license GPL-2.0+ + */ +class DispatchingTermSearchInteractorTest extends PHPUnit_Framework_TestCase { + + public function provideInvalidInteractorConfig() { + return [ + 'non-TermSearchInteractor values' => [ + [ 'item' => 'foo' ] + ], + 'non-string keys' => [ + [ 0 => $this->getTermSearchInteractor( [] ) ] + ] + ]; + } + + /** + * @dataProvider provideInvalidInteractorConfig + */ + public function testGivenInvalidInteractorConfig_exceptionIsThrown( array $interactors ) { + $this->setExpectedException( ParameterAssertionException::class ); + new DispatchingTermSearchInteractor( $interactors ); + } + + private function getTermSearchInteractor( array $resultsByEntityType ) { + $interactor = $this->getMockBuilder( TermSearchInteractor::class )->getMock(); + $interactor->expects( $this->any() ) + ->method( 'searchForEntities' ) + ->will( $this->returnCallback( + function ( $text, $language, $entityType ) use ( $resultsByEntityType ) { + return isset( $resultsByEntityType[$entityType] ) ? $resultsByEntityType[$entityType] : []; + } + ) ); + return $interactor; + } + + public function testSearchForEntities_usesTheInteractorConfiguredForEntityType() { + $interactorOne = $this->getTermSearchInteractor( [ + 'item' => [ + new TermSearchResult( + new Term( 'en', 'foot' ), + 'label', + new ItemId( 'Q123' ) + ), + new TermSearchResult( + new Term( 'en', 'fox' ), + 'label', + new ItemId( 'Q321' ) + ), + ], + 'property' => [ + new TermSearchResult( + new Term( 'en', 'founder' ), + 'label', + new PropertyId( 'P123' ) + ), + ] + ] ); + $interactorTwo = $this->getTermSearchInteractor( [ + 'property' => [ + new TermSearchResult( + new Term( 'en', 'follows' ), + 'label', + new PropertyId( 'baz:P322' ) + ), + new TermSearchResult( + new Term( 'en', 'followed by' ), + 'label', + new PropertyId( 'baz:P567' ) + ), + ] + ] ); + + $interactor = new DispatchingTermSearchInteractor( [ + 'item' => $interactorOne, + 'property' => $interactorTwo, + ] ); + + $this->assertEquals( + [ + new TermSearchResult( + new Term( 'en', 'foot' ), + 'label', + new ItemId( 'Q123' ) + ), + new TermSearchResult( + new Term( 'en', 'fox' ), + 'label', + new ItemId( 'Q321' ) + ), + ], + $interactor->searchForEntities( 'fo', 'en', 'item', [ TermIndexEntry::TYPE_LABEL ] ) + ); + $this->assertEquals( + [ + new TermSearchResult( + new Term( 'en', 'follows' ), + 'label', + new PropertyId( 'baz:P322' ) + ), + new TermSearchResult( + new Term( 'en', 'followed by' ), + 'label', + new PropertyId( 'baz:P567' ) + ), + ], + $interactor->searchForEntities( 'fo', 'en', 'property', [ TermIndexEntry::TYPE_LABEL ] ) + ); + } + +} diff --git a/extensions/Wikibase/lib/tests/phpunit/Interactors/TermSearchResultTest.php b/extensions/Wikibase/lib/tests/phpunit/Interactors/TermSearchResultTest.php index b8a41f8..55481e1 100644 --- a/extensions/Wikibase/lib/tests/phpunit/Interactors/TermSearchResultTest.php +++ b/extensions/Wikibase/lib/tests/phpunit/Interactors/TermSearchResultTest.php @@ -27,13 +27,23 @@ new ItemId( 'Q1234' ), new Term( 'pt', 'ImaLabel' ), new Term( 'en', 'ImaDescription' ), + '' ), array( new Term( 'en-gb', 'FooText' ), 'description', new PropertyId( 'P777' ), null, - null + null, + '' + ), + array( + new Term( 'en-gb', 'FooText' ), + 'description', + new PropertyId( 'foo:P777' ), + null, + null, + 'foo' ), ); } @@ -46,7 +56,8 @@ $matchedTermType, $entityId, $displayLabel, - $displayDescription + $displayDescription, + $expectedRepositoryName ) { $result = new TermSearchResult( $matchedTerm, @@ -59,6 +70,7 @@ $this->assertEquals( $matchedTerm, $result->getMatchedTerm() ); $this->assertEquals( $matchedTermType, $result->getMatchedTermType() ); $this->assertEquals( $entityId, $result->getEntityId() ); + $this->assertEquals( $expectedRepositoryName, $result->getRepositoryName() ); $this->assertEquals( $displayLabel, $result->getDisplayLabel() ); $this->assertEquals( $displayDescription, $result->getDisplayDescription() ); } diff --git a/extensions/Wikibase/lib/tests/phpunit/Store/Sql/TermSqlIndexTest.php b/extensions/Wikibase/lib/tests/phpunit/Store/Sql/TermSqlIndexTest.php index 7ba1b3d..6e6a545 100644 --- a/extensions/Wikibase/lib/tests/phpunit/Store/Sql/TermSqlIndexTest.php +++ b/extensions/Wikibase/lib/tests/phpunit/Store/Sql/TermSqlIndexTest.php @@ -2,7 +2,9 @@ namespace Wikibase\Lib\Tests\Store; +use MWException; use Wikibase\DataModel\Entity\EntityDocument; +use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\Entity\PropertyId; @@ -15,6 +17,7 @@ use Wikibase\StringNormalizer; use Wikibase\TermIndexEntry; use Wikibase\TermSqlIndex; +use Wikimedia\Assert\ParameterAssertionException; /** * @covers Wikibase\TermSqlIndex @@ -42,18 +45,45 @@ $this->tablesUsed[] = 'wb_terms'; } + public function provideInvalidRepositoryNames() { + return [ + 'repository name containing colon' => [ 'foo:bar' ], + 'non-string as repository name' => [ 12345 ], + ]; + } + + /** + * @dataProvider provideInvalidRepositoryNames + */ + public function testGivenInvalidRepositoryName_constructorThrowsException( $repositoryName ) { + $this->setExpectedException( ParameterAssertionException::class ); + new TermSqlIndex( + new StringNormalizer(), + new EntityIdComposer( [ + 'item' => function( $repositoryName, $uniquePart ) { + return new ItemId( 'Q' . $uniquePart ); + }, + ] ), + false, + $repositoryName + ); + } + /** * @return TermSqlIndex */ public function getTermIndex() { - return new TermSqlIndex( new StringNormalizer(), new EntityIdComposer( [ - 'item' => function( $repositoryName, $uniquePart ) { - return new ItemId( 'Q' . $uniquePart ); - }, - 'property' => function( $repositoryName, $uniquePart ) { - return new PropertyId( 'P' . $uniquePart ); - }, - ] ) ); + return new TermSqlIndex( + new StringNormalizer(), + new EntityIdComposer( [ + 'item' => function( $repositoryName, $uniquePart ) { + return new ItemId( 'Q' . $uniquePart ); + }, + 'property' => function( $repositoryName, $uniquePart ) { + return new PropertyId( 'P' . $uniquePart ); + }, + ] ) + ); } public function termProvider() { @@ -96,6 +126,48 @@ $this->assertEquals( $termText, $obtainedTerm->getText() ); } + } + + /** + * Returns a fake term index configured for the given repository which uses the local database. + * + * @param string $repository + * @return TermSqlIndex + */ + private function getTermIndexForRepository( $repository ) { + return new TermSqlIndex( + new StringNormalizer(), + new EntityIdComposer( [ + 'item' => function( $repositoryName, $uniquePart ) { + return new ItemId( EntityId::joinSerialization( [ $repositoryName, '', 'Q' . $uniquePart ] ) ); + }, + 'property' => function( $repositoryName, $uniquePart ) { + return new PropertyId( EntityId::joinSerialization( [ $repositoryName, '', 'P' . $uniquePart ] ) ); + }, + ] ), + false, + $repository + ); + } + + public function testGivenForeignRepositoryName_getMatchingTermsReturnsEntityIdWithTheRepositoryPrefix() { + $localTermIndex = $this->getTermIndex(); + + $item = new Item( new ItemId( 'Q300' ) ); + $item->setLabel( 'en', 'Foo' ); + + $localTermIndex->saveTermsOfEntity( $item ); + + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $results = $fooTermIndex->getMatchingTerms( [ new TermIndexSearchCriteria( [ 'termText' => 'Foo' ] ) ] ); + + $this->assertCount( 1, $results ); + + $termIndexEntry = $results[0]; + + $this->assertTrue( $termIndexEntry->getEntityId()->equals( new ItemId( 'foo:Q300' ) ) ); + $this->assertEquals( 'Foo', $termIndexEntry->getText() ); } /** @@ -312,4 +384,67 @@ } } + public function testGivenForeignRepositoryName_getTermsOfEntitiesReturnsEntityIdsWithRepositoryPrefix() { + $localTermIndex = $this->getTermIndex(); + + $item = new Item( new ItemId( 'Q300' ) ); + $item->setLabel( 'en', 'Foo' ); + + $localTermIndex->saveTermsOfEntity( $item ); + + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $results = $fooTermIndex->getTermsOfEntities( [ new ItemId( 'foo:Q300' ) ] ); + + $this->assertCount( 1, $results ); + + $termIndexEntry = $results[0]; + + $this->assertTrue( $termIndexEntry->getEntityId()->equals( new ItemId( 'foo:Q300' ) ) ); + $this->assertEquals( 'Foo', $termIndexEntry->getText() ); + } + + public function testGivenEntityIdFromAnotherRepository_getTermsOfEntitiesThrowsException() { + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $this->setExpectedException( MWException::class ); + + $fooTermIndex->getTermsOfEntities( [ new ItemId( 'Q300' ) ] ); + } + + public function testGivenEntityIdFromAnotherRepository_getTermsOfEntityThrowsException() { + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $this->setExpectedException( MWException::class ); + + $fooTermIndex->getTermsOfEntity( new ItemId( 'Q300' ) ); + } + + public function testGivenEntityFromAnotherRepository_getEntityTermsThrowsException() { + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $this->setExpectedException( MWException::class ); + + $fooTermIndex->getEntityTerms( new Item( new ItemId( 'Q300' ) ) ); + } + + public function testGivenEntityFromAnotherRepository_saveTermsOfEntityThrowsException() { + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $item = new Item( new ItemId( 'Q300' ) ); + $item->setLabel( 'en', 'Foo' ); + + $this->setExpectedException( MWException::class ); + + $fooTermIndex->saveTermsOfEntity( $item ); + } + + public function testGivenEntityFromAnotherRepository_deleteTermsOfEntityThrowsException() { + $fooTermIndex = $this->getTermIndexForRepository( 'foo' ); + + $this->setExpectedException( MWException::class ); + + $fooTermIndex->deleteTermsOfEntity( new ItemId( 'Q300' ) ); + } + } diff --git a/extensions/Wikibase/repo/i18n/azb.json b/extensions/Wikibase/repo/i18n/azb.json index 26a82fa..3b4413e 100644 --- a/extensions/Wikibase/repo/i18n/azb.json +++ b/extensions/Wikibase/repo/i18n/azb.json @@ -3,7 +3,8 @@ "authors": [ "Erdemaslancan", "Amir a57", - "Koroğlu" + "Koroğlu", + "Alp Er Tunqa" ] }, "wikibase-edit": "دَییشدیر", @@ -12,8 +13,8 @@ "wikibase-description-empty": "هئچ بیر آچیقلاما تعریف اولماییبدیر.", "wikibase-statementsection-statements": "ایظهالار", "wikibase-sitelinks-special": "آیری سایتلار", - "wikibase-aliases-empty": "هئچ بیر موستعار آدی سئچیلمییب.", "wikibase-statementview-rank-normal": "نورمال درجه", "wikibase-statementview-references-counter": "$1{{PLURAL:$2|0=|$3+$2$4}} {{PLURAL:$1|قایناق|قایناقلار}}", - "wikibase-itembytitle-lookup-page": "مقاله:" + "wikibase-itembytitle-lookup-page": "مقاله:", + "wikibase-gotolinkedpage-submit": "گئت" } diff --git a/extensions/Wikibase/repo/i18n/pt.json b/extensions/Wikibase/repo/i18n/pt.json index 65155ab..93b43ff 100644 --- a/extensions/Wikibase/repo/i18n/pt.json +++ b/extensions/Wikibase/repo/i18n/pt.json @@ -143,7 +143,7 @@ "wikibase-itembytitle-create": "Também pode [$1 criar um objeto].", "wikibase-itembytitle-summary": "A página Special:ItemByTitle é usada para encontrar o objeto que corresponde a uma determinada página num ''site'' ligado.<br />O primeiro campo, \"{{int:wikibase-itembytitle-lookup-site}}\", é onde introduz a língua e o código do ''site''.<br />No segundo campo, \"{{int:wikibase-itembytitle-lookup-page}}\", tem de colocar o título exato da página tal como ele aparece no ''site'' ligado.", "special-gotolinkedpage": "Ir para a página ligada", - "wikibase-gotolinkedpage-lookup-fieldset": "Ir para página ligada por ''site'' e objeto", + "wikibase-gotolinkedpage-lookup-fieldset": "Ir para página ligada por site e objeto", "wikibase-gotolinkedpage-lookup-site": "Site:", "wikibase-gotolinkedpage-lookup-item": "Identificador do objeto:", "wikibase-gotolinkedpage-submit": "Continuar", @@ -156,7 +156,7 @@ "wikibase-itemdisambiguation-lookup-language": "Código de língua:", "wikibase-itemdisambiguation-lookup-label": "Rótulo:", "wikibase-itemdisambiguation-submit": "Pesquisar", - "wikibase-itemdisambiguation-form-hints": "Repare que não serão mostrados mais de $1 {{PLURAL:$1|resultado|resultados}}.", + "wikibase-itemdisambiguation-form-hints": "Note que não serão mostrados mais de $1 {{PLURAL:$1|resultado|resultados}}.", "wikibase-itemdisambiguation-nothing-found": "Desculpe, não foi encontrado nenhum objeto com esse rótulo.", "wikibase-itemdisambiguation-search": "Pode [$1 procurar o objeto].", "wikibase-itemdisambiguation-create": "Pode [$1 criar o objeto].", @@ -187,12 +187,12 @@ "wikibase-setlabel-introfull": "Está a definir o rótulo em \"$2\" para [[$1]].", "wikibase-setlabel-intro": "Este formulário permite-lhe definir o rótulo de uma entidade. Precisa de fornecer o identificador da entidade (ex: Q23), um código de língua (ex: \"pt\") e o rótulo a ser definido.", "wikibase-setlabel-label": "Rótulo:", - "wikibase-setlabel-submit": "Definir rótulo", + "wikibase-setlabel-submit": "Definir o rótulo", "special-setdescription": "Definir uma descrição", "wikibase-setdescription-introfull": "Está a definir a descrição em \"$2\" para [[$1]].", "wikibase-setdescription-intro": "Este formulário permite-lhe definir a descrição de uma entidade. Precisa de fornecer o identificador da entidade (ex: Q23), um código de língua (ex: \"pt\") e a descrição a ser definida.", "wikibase-setdescription-label": "Descrição:", - "wikibase-setdescription-submit": "Definir descrição", + "wikibase-setdescription-submit": "Definir a descrição", "special-setaliases": "Definir nomes alternativos", "wikibase-setaliases-introfull": "Está a definir os nomes alternativos em $2 para [[$1]]. Se forem vários, separe os nomes alternativos usando a barra vertical (<code>|</code>).", "wikibase-setaliases-intro": "Este formulário permite-lhe definir os nomes alternativos de uma entidade. Precisa de fornecer o identificador da entidade (ex: Q23), um código de língua (ex: \"pt\") e os nomes alternativos a serem definidos. Se forem vários, separe os nomes alternativos usando uma barra vertical (<code>|</code>).", @@ -207,12 +207,12 @@ "wikibase-setlabeldescriptionaliases-submit": "Definir rótulo, descrição e nomes alternativos", "special-setsitelink": "Definir um link intersites", "wikibase-setsitelink-introfull": "Está a definir o ''link intersites'' em \"$2\" para [[$1]].", - "wikibase-setsitelink-intro": "Este formulário permite-lhe definir o ''link intersites'' de uma entidade. Deve fornecer o identificador da entidade (ex: Q23), um código de língua (ex: \"pt\") e o ''link intersites'' a ser definido.", + "wikibase-setsitelink-intro": "Este formulário permite-lhe definir o link intersites de uma entidade. Deve fornecer o identificador da entidade (ex: Q23), um código de língua (ex: \"pt\") e o link intersites a ser definido.", "wikibase-setsitelink-intro-badges": "Adicionalmente, pode definir vários emblemas para este ''link intersites'', os quais são listados abaixo.", - "wikibase-setsitelink-site": "Identificador do ''site'':", - "wikibase-setsitelink-label": "''Link intersites'':", + "wikibase-setsitelink-site": "Identificador do site:", + "wikibase-setsitelink-label": "Link intersites:", "wikibase-setsitelink-badges": "Emblemas:", - "wikibase-setsitelink-submit": "Definir o ''link intersites''", + "wikibase-setsitelink-submit": "Definir o link intersites", "wikibase-setsitelink-invalid-site": "O identificador de ''site'' \"$1\" é desconhecido. Use um identificador de ''site'' existente, como \"enwiki\", por favor.", "wikibase-setsitelink-not-item": "O identificador $1 não pertence a um objeto.", "wikibase-setsitelink-not-badge": "O identificador $1 não é um emblema.", @@ -246,7 +246,7 @@ "wikibase-dispatchstats-change-timestamp": "Data e hora", "wikibase-dispatchstats-oldest-change": "Mais antiga", "wikibase-dispatchstats-newest-change": "Mais recente", - "wikibase-dispatchstats-site-id": "''Site''", + "wikibase-dispatchstats-site-id": "Site", "wikibase-dispatchstats-pos": "Posição", "wikibase-dispatchstats-lag-num": "Pendente", "wikibase-dispatchstats-lag-time": "Atraso", @@ -256,12 +256,12 @@ "wikibase-dispatchstats-stalest": "Mais antigo", "wikibase-dispatchstats-median": "Mediana", "wikibase-dispatchstats-average": "Média", - "special-listdatatypes": "Lista de todos os tipos de dados disponíveis", + "special-listdatatypes": "Tipos de dados", "wikibase-listdatatypes-intro": "Esta é uma lista de todos os tipos de dados disponíveis nesta instalação:", "wikibase-listdatatypes-listproperties": "Lista de propriedades com este tipo de dados", "wikibase-history-title-with-label": "Histórico de revisões de \"$2\" ($1)", "wikibase-history-title-without-label": "Histórico de revisões de ($1)", - "special-listproperties": "Lista de propriedades", + "special-listproperties": "Propriedades", "wikibase-listproperties-legend": "Obter uma lista de propriedades por tipo de dados", "wikibase-listproperties-datatype": "Tipo de dados:", "wikibase-listproperties-all": "Todos os tipos de dados", @@ -277,7 +277,7 @@ "wikibase-entitieswithoutlabel-submit": "Procurar", "wikibase-entitieswithoutlabel-invalid-language": "\"$1\" não é um código de língua válido.", "wikibase-entitieswithoutlabel-invalid-type": "\"$1\" não é um tipo de entidade válido.", - "special-itemswithoutsitelinks": "Objetos sem ''links intersites''", + "special-itemswithoutsitelinks": "Objetos sem links intersites", "special-entitydata": "Dados de entidade", "wikibase-entitydata-not-found": "Não foi encontrada nenhuma entidade com o identificador $1.", "wikibase-entitydata-not-acceptable": "Não foi encontrado nenhum formato correspondente. Tipos MIME suportados: $1", @@ -315,9 +315,9 @@ "wikibase-listdatatypes-wikibase-item-body": "''Link'' para outros objetos no projeto. Quando um valor é introduzido, serão pesquisados objetos correspondentes no espaço nominal \"Item\" (objeto) do projeto.", "wikibase-listdatatypes-wikibase-property-head": "Propriedade", "wikibase-listdatatypes-wikibase-property-body": "''Link'' para propriedades no projeto. Quando um valor é introduzido, serão pesquisadas propriedades correspondentes no espaço nominal \"Property\" (propriedade) do projeto.", - "wikibase-listdatatypes-commonsmedia-head": "Multimédia da wiki Commons", + "wikibase-listdatatypes-commonsmedia-head": "Ficheiro multimédia do Commons", "wikibase-listdatatypes-commonsmedia-body": "''Link'' para ficheiros alojados na wiki Wikimedia Commons. Quando um valor é introduzido, serão pesquisados ficheiros correspondentes no espaço nominal \"File\" (ficheiro) da wiki Commons.", - "wikibase-listdatatypes-globe-coordinate-head": "Coordenada geográficas", + "wikibase-listdatatypes-globe-coordinate-head": "Coordenada geográfica", "wikibase-listdatatypes-globe-coordinate-body": "Dados literais para uma posição geográfica no formato latitude-longitude em GMS ou em graus decimais para o corpo celeste indicado. Por omissão, será \"Terra\" e depois \"WGS84\". Adiciona uma resolução e um intervalo.\n* latitude – primeira parte implícita (float, dms, dm, dd) da ''string'' de coordenadas, a direção é dada por um sinal, como prefixo, ou por N/S, como sufixo\n* longitude – segunda parte implícita (float, dms, dm, dd) da ''string'' de coordenadas, a direção é dada por um sinal, como prefixo, ou por E/W, como sufixo\n* globe (corpo celeste) – valor de dados explícito (?), na forma de um corpo celeste que, por omissão, é a Terra \"http://www.wikidata.org/entity/Q2\"\n* precision (precisão) - precisão numérica da coordenada", "wikibase-listdatatypes-quantity-head": "Quantidade", "wikibase-listdatatypes-quantity-body": "Campo de dados literal para uma quantidade de uma unidade perfeitamente definida. A unidade é colocada no valor de dados que é introduzido.\n* amount (quantidade) – parte implícita da ''string'' (o mapeamento do prefixo da unidade não é claro)\n* unit (unidade) – parte implícita da ''string'' que, por omissão, é \"1\" (o mapeamento para o corpo padronizante não é claro)\n* upperbound - limite superior da quantidade\n* lowerbound - limite inferior da quantidade", @@ -327,7 +327,7 @@ "wikibase-listdatatypes-multilingualtext-body": "Campo de dados literal para um texto que tem de ser traduzido para outras línguas. Tipicamente é usado no nome de uma entidade de interesse global, com formas escritas globais diferentes da forma local. Estas podem ser diferentes entre línguas e entre alfabetos.\n* language (língua) - valor explícito para identificar a língua da parte de texto\n* value (valor) - valor explícito do texto na variante específica da língua", "wikibase-listdatatypes-string-head": "Texto", "wikibase-listdatatypes-string-body": "Campo de dados literal para um texto de glifos. Tipicamente, é usado para identificadores com formas escritas que não dependem da língua do leitor.\n* value (valor) - valor explícito do texto na variante específica da língua", - "wikibase-listdatatypes-time-head": "Hora", + "wikibase-listdatatypes-time-head": "Tempo", "wikibase-listdatatypes-time-body": "Campo de dados literal para um ponto no tempo. Fornecido como data e hora, com alguma precisão e limites. A hora é gravada internamente no modelo de calendário especificado.\n* time (data e hora) – valor explícito para um ponto no tempo, numa forma parecida ao formato ISO 8601, e.g. +2013-01-01T00:00:00Z. O ano tem sempre um sinal e é preenchido para ter entre 4 e 16 algarismos.\n* timezone (fuso horário) - valor explícito na forma de um inteiro com sinal, dado como a diferença em relação a UTC, em minutos.\n* before (antes) - valor explícito na forma de um inteiro, para o número de unidades possível depois da data e hora fornecida. A unidade é dada pela precisão.\n* after (depois) - valor explícito na forma de um inteiro, para o número de unidades possível antes da data e hora fornecida. A unidade é dada pela precisão.\n* precision (precisão) - valor explícito codificado como um inteiro curto (\"shortint\"). Os números têm o seguinte significado: 0 - mil milhões de anos, 1 - cem milhões de anos, ..., 6 - milénio, 7 - século, 8 - década, 9 - ano, 10 - mês, 11 - dia, 12 - hora, 13 - minuto, 14 - segundo.\n* calendarmodel (modelo de calendário) - valor explícito na forma de um URI. Identifica o modelo de calendário da data e hora.", "wikibase-listdatatypes-url-head": "URL", "wikibase-listdatatypes-url-body": "Campo de dados para um URL. Os URL estão restritos aos protocolos que também são suportados para ''links'' externos em texto wiki.", @@ -353,7 +353,7 @@ "wikibase-pageinfo-subscription-none": "Nenhuma", "apihelp-wbavailablebadges-description": "Consulta os objetos de emblemas disponíveis.", "apihelp-wbavailablebadges-example-1": "Consulta todos os objetos de emblemas disponíveis", - "apihelp-wbcreateclaim-description": "Cria alegações Wikidata.", + "apihelp-wbcreateclaim-description": "Cria alegações Wikibase.", "apihelp-wbcreateclaim-param-baserevid": "O identificador numérico da revisão na qual será baseada a modificação.\nÉ usado para detetar conflitos durante a gravação.", "apihelp-wbcreateclaim-param-bot": "Marcar esta edição como uma edição por robô. Esta etiqueta URL só será respeitada se o utilizador pertencer ao grupo \"robôs\".", "apihelp-wbcreateclaim-param-entity": "Identificador da entidade à qual a alegação está a ser adicionada", diff --git a/extensions/Wikibase/repo/i18n/udm.json b/extensions/Wikibase/repo/i18n/udm.json index b54d777..2d4e6af 100644 --- a/extensions/Wikibase/repo/i18n/udm.json +++ b/extensions/Wikibase/repo/i18n/udm.json @@ -10,7 +10,9 @@ "wikibase-cancel": "берытсконо", "wikibase-add": "ватсаны", "wikibase-entitytermsview-entitytermsforlanguagelistview-toggler": "Мукет кылъёсын", + "wikibase-description-empty": "Описаниез ӧвӧл", "wikibase-sitelinks-special": "Мукет сайтъёс", + "wikibase-statementview-rank-normal": "Огшоры ранг", "wikibase-entityselector-more": "эшшо", "wikibase-history-title-with-label": "«$2» ($1) воштонъёслэн историзы", "wikibase-history-title-without-label": "$1 — воштонъёслэн историзы", diff --git a/extensions/Wikibase/repo/tests/browser b/extensions/Wikibase/repo/tests/browser deleted file mode 120000 index c377a0f..0000000 --- a/extensions/Wikibase/repo/tests/browser +++ /dev/null @@ -1 +0,0 @@ -../../tests/browser/ \ No newline at end of file diff --git a/extensions/Wikibase/repo/tests/browser b/extensions/Wikibase/repo/tests/browser new file mode 100644 index 0000000..c377a0f --- /dev/null +++ b/extensions/Wikibase/repo/tests/browser @@ -0,0 +1 @@ +../../tests/browser/ \ No newline at end of file diff --git a/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/jquery.wikibase.toolbar.js b/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/jquery.wikibase.toolbar.js old mode 100755 new mode 100644 diff --git a/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbar.css b/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbar.css old mode 100755 new mode 100644 diff --git a/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbarbutton.css b/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbarbutton.css old mode 100755 new mode 100644 diff --git a/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbaritem.css b/extensions/Wikibase/view/resources/jquery/wikibase/toolbar/themes/default/jquery.wikibase.toolbaritem.css old mode 100755 new mode 100644 diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE index 1a28124..b0794ff 100644 --- a/vendor/composer/LICENSE +++ b/vendor/composer/LICENSE @@ -1,4 +1,3 @@ - Copyright (c) 2016 Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy @@ -18,4 +17,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 18fb43b..531e661 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -822,6 +822,7 @@ 'Wikibase\\Lib\\GlobeCoordinateDetailsFormatter' => $baseDir . '/extensions/Wikibase/lib/includes/Formatters/GlobeCoordinateDetailsFormatter.php', 'Wikibase\\Lib\\HtmlTimeFormatter' => $baseDir . '/extensions/Wikibase/lib/includes/Formatters/HtmlTimeFormatter.php', 'Wikibase\\Lib\\HtmlUrlFormatter' => $baseDir . '/extensions/Wikibase/lib/includes/Formatters/HtmlUrlFormatter.php', + 'Wikibase\\Lib\\Interactors\\DispatchingTermSearchInteractor' => $baseDir . '/extensions/Wikibase/lib/includes/Interactors/DispatchingTermSearchInteractor.php', 'Wikibase\\Lib\\Interactors\\TermIndexSearchInteractor' => $baseDir . '/extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php', 'Wikibase\\Lib\\Interactors\\TermSearchInteractor' => $baseDir . '/extensions/Wikibase/lib/includes/Interactors/TermSearchInteractor.php', 'Wikibase\\Lib\\Interactors\\TermSearchOptions' => $baseDir . '/extensions/Wikibase/lib/includes/Interactors/TermSearchOptions.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 5a80dc3..ecba7f1 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -109,6 +109,46 @@ ] }, { + "name": "mediawiki/article-placeholder", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git", + "reference": "197aabc07ea2f998079b0268c6b56eb2947a0269" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/197aabc07ea2f998079b0268c6b56eb2947a0269", + "reference": "197aabc07ea2f998079b0268c6b56eb2947a0269", + "shasum": "" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/mediawiki-codesniffer": "0.7.2" + }, + "time": "2016-11-30 14:30:13", + "type": "mediawiki-extension", + "installation-source": "dist", + "autoload": { + "psr-4": { + "ArticlePlaceholder\\": "includes/", + "ArticlePlaceholder\\Specials\\": "includes/specials/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Lucie-Aimée Kaffee" + } + ], + "description": "Provides a special page with Wikibase information about a certain topic, with invitation to create an article for the topic", + "homepage": "https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder" + }, + { "name": "wikimedia/purtle", "version": "v1.0.4", "version_normalized": "1.0.4.0", @@ -519,17 +559,17 @@ }, { "name": "wikibase/data-model", - "version": "6.3.0", - "version_normalized": "6.3.0.0", + "version": "6.3.1", + "version_normalized": "6.3.1.0", "source": { "type": "git", "url": "https://github.com/wmde/WikibaseDataModel.git", - "reference": "da73698973282d7cc177faf8995bf5d7e526b859" + "reference": "c16667e30b8c3e98573779b46f7099e55021d5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wmde/WikibaseDataModel/zipball/da73698973282d7cc177faf8995bf5d7e526b859", - "reference": "da73698973282d7cc177faf8995bf5d7e526b859", + "url": "https://api.github.com/repos/wmde/WikibaseDataModel/zipball/c16667e30b8c3e98573779b46f7099e55021d5e2", + "reference": "c16667e30b8c3e98573779b46f7099e55021d5e2", "shasum": "" }, "require": { @@ -542,7 +582,7 @@ "phpmd/phpmd": "~2.3", "squizlabs/php_codesniffer": "~2.3" }, - "time": "2016-11-03 17:28:04", + "time": "2016-11-30 16:04:13", "type": "library", "extra": { "branch-alias": { @@ -1360,6 +1400,93 @@ ] }, { + "name": "wikibase/wikibase", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", + "reference": "fac6549d01e069a7b86f8bc59d2e55bc61f6410a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/fac6549d01e069a7b86f8bc59d2e55bc61f6410a", + "reference": "fac6549d01e069a7b86f8bc59d2e55bc61f6410a", + "shasum": "" + }, + "require": { + "data-values/common": "~0.3.0", + "data-values/data-types": "~0.5.0", + "data-values/data-values": "~1.0", + "data-values/geo": "~1.0", + "data-values/interfaces": "~0.2.0|~0.1.5", + "data-values/javascript": "~0.8.3", + "data-values/number": "~0.8.2", + "data-values/serialization": "~1.1", + "data-values/time": "~0.8.4", + "data-values/validators": "~0.1.0", + "data-values/value-view": "~0.18.0", + "diff/diff": "~2.0", + "php": ">=5.5.0", + "wikibase/data-model": "^6.3.1", + "wikibase/data-model-javascript": "~3.0.0", + "wikibase/data-model-serialization": "~2.2", + "wikibase/data-model-services": "~3.7", + "wikibase/internal-serialization": "~2.3", + "wikibase/javascript-api": "~2.2.0", + "wikibase/serialization-javascript": "~2.0.6", + "wikimedia/purtle": "~1.0" + }, + "conflict": { + "mediawiki/mediawiki": "<1.25" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/mediawiki-codesniffer": "0.4.0|0.5.0" + }, + "time": "2016-11-30 21:22:39", + "type": "mediawiki-extension", + "installation-source": "dist", + "autoload": { + "classmap": [ + "client/includes/", + "client/WikibaseClient.hooks.php", + "client/tests/phpunit/MockClientStore.php", + "lib/includes/", + "lib/WikibaseLib.hooks.php", + "lib/maintenance/", + "repo/includes/", + "repo/maintenance/", + "repo/tests/phpunit/", + "repo/Wikibase.hooks.php" + ], + "psr-4": { + "Wikibase\\Client\\Tests\\": "client/tests/phpunit/includes", + "Wikibase\\Lib\\Tests\\": "lib/tests/phpunit", + "Wikibase\\View\\": "view/src", + "Wikibase\\View\\Tests\\": "view/tests/phpunit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "The Wikidata team" + } + ], + "description": "Structured data repository for MediaWiki", + "homepage": "http://wikiba.se", + "keywords": [ + "wikibase", + "wikibaseclient", + "wikibaselib", + "wikibaserepo", + "wikidata" + ] + }, + { "name": "wikibase/wikimedia-badges", "version": "dev-master", "version_normalized": "9999999-dev", @@ -1454,6 +1581,124 @@ "Wikidata" ], "support": { + "irc": "irc://irc.freenode.net/wikidata" + } + }, + { + "name": "wikibase/external-validation", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityExternalValidation", + "reference": "be08e45df0f9021ec90442688fa4a9bfb0e221d1" + }, + "require": { + "data-values/common": ">=0.1 <0.4", + "data-values/geo": "~1.0", + "data-values/number": ">=0.1 <0.9", + "data-values/time": "~0.8", + "php": ">=5.5.0", + "serialization/serialization": "3.*,>=3.2.1", + "wikibase/data-model": "~4.2|~5.0|~6.0", + "wikibase/data-model-serialization": "~2.0", + "wikibase/data-model-services": "~2.0|~3.0" + }, + "require-dev": { + "phpunit/phpunit": "~3.7,>=3.7.37", + "satooshi/php-coveralls": "dev-master" + }, + "time": "2016-11-30 13:52:02", + "type": "mediawiki-extension", + "installation-source": "source", + "autoload": { + "psr-4": { + "WikibaseQuality\\ExternalValidation\\": "includes/", + "WikibaseQuality\\ExternalValidation\\Api\\": "api/", + "WikibaseQuality\\ExternalValidation\\Specials\\": "specials/", + "WikibaseQuality\\ExternalValidation\\Tests\\": "tests/phpunit/" + }, + "classmap": [ + "WikibaseQualityExternalValidationHooks.php", + "maintenance/UpdateExternalData.php" + ] + }, + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "BP2014N1" + } + ], + "description": "Extension for WikibaseQuality to perform cross-checks with external databases.", + "homepage": "https://www.mediawiki.org/wiki/WikidataQuality/", + "keywords": [ + "database", + "external", + "quality", + "trust", + "violation", + "wikibase", + "wikidata" + ], + "support": { + "issues": "https://phabricator.wikimedia.org/project/profile/1203/" + } + }, + { + "name": "wikibase/media-info", + "version": "dev-master", + "version_normalized": "9999999-dev", + "source": { + "type": "git", + "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseMediaInfo", + "reference": "c7b71fdf31305500d8c57793f7cbd93c1f3a9705" + }, + "require": { + "php": ">=5.5.0", + "serialization/serialization": "~3.2", + "wikibase/data-model": "~6.1", + "wikibase/data-model-serialization": "~2.0", + "wikibase/data-model-services": "~3.6" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/mediawiki-codesniffer": "0.6.0", + "phpunit/phpunit": "~4.8" + }, + "time": "2016-11-29 10:33:33", + "type": "mediawiki-extension", + "installation-source": "source", + "autoload": { + "psr-4": { + "Wikibase\\MediaInfo\\": "src/", + "Wikibase\\MediaInfo\\Tests\\": "tests/phpunit/composer/", + "Wikibase\\MediaInfo\\Tests\\MediaWiki\\": "tests/phpunit/mediawiki/" + } + }, + "scripts": { + "fix": [ + "phpcbf" + ], + "test": [ + "parallel-lint . --exclude vendor", + "phpcs -p -s", + "phpunit" + ] + }, + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "The Wikidata team" + } + ], + "description": "Wikibase extension to manage structured metadata of media files", + "homepage": "http://wikiba.se", + "support": { + "issues": "https://phabricator.wikimedia.org/", "irc": "irc://irc.freenode.net/wikidata" } }, @@ -1616,251 +1861,6 @@ ], "support": { "issues": "https://phabricator.wikimedia.org/project/profile/1202/" - } - }, - { - "name": "mediawiki/article-placeholder", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/mediawiki-extensions-ArticlePlaceholder.git", - "reference": "16994f2031c33dba11ca997283397397ac313a28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-ArticlePlaceholder/zipball/16994f2031c33dba11ca997283397397ac313a28", - "reference": "16994f2031c33dba11ca997283397397ac313a28", - "shasum": "" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.7.2" - }, - "time": "2016-11-30 11:53:18", - "type": "mediawiki-extension", - "installation-source": "dist", - "autoload": { - "psr-4": { - "ArticlePlaceholder\\": "includes/", - "ArticlePlaceholder\\Specials\\": "includes/specials/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Lucie-Aimée Kaffee" - } - ], - "description": "Provides a special page with Wikibase information about a certain topic, with invitation to create an article for the topic", - "homepage": "https://www.mediawiki.org/wiki/Extension:ArticlePlaceholder" - }, - { - "name": "wikibase/wikibase", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "c7fa54a43b3375770a97e93e6a1c539ffe940edc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/c7fa54a43b3375770a97e93e6a1c539ffe940edc", - "reference": "c7fa54a43b3375770a97e93e6a1c539ffe940edc", - "shasum": "" - }, - "require": { - "data-values/common": "~0.3.0", - "data-values/data-types": "~0.5.0", - "data-values/data-values": "~1.0", - "data-values/geo": "~1.0", - "data-values/interfaces": "~0.2.0|~0.1.5", - "data-values/javascript": "~0.8.3", - "data-values/number": "~0.8.2", - "data-values/serialization": "~1.1", - "data-values/time": "~0.8.4", - "data-values/validators": "~0.1.0", - "data-values/value-view": "~0.18.0", - "diff/diff": "~2.0", - "php": ">=5.5.0", - "wikibase/data-model": "~6.3", - "wikibase/data-model-javascript": "~3.0.0", - "wikibase/data-model-serialization": "~2.2", - "wikibase/data-model-services": "~3.7", - "wikibase/internal-serialization": "~2.3", - "wikibase/javascript-api": "~2.2.0", - "wikibase/serialization-javascript": "~2.0.6", - "wikimedia/purtle": "~1.0" - }, - "conflict": { - "mediawiki/mediawiki": "<1.25" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.4.0|0.5.0" - }, - "time": "2016-11-30 13:52:49", - "type": "mediawiki-extension", - "installation-source": "dist", - "autoload": { - "classmap": [ - "client/includes/", - "client/WikibaseClient.hooks.php", - "client/tests/phpunit/MockClientStore.php", - "lib/includes/", - "lib/WikibaseLib.hooks.php", - "lib/maintenance/", - "repo/includes/", - "repo/maintenance/", - "repo/tests/phpunit/", - "repo/Wikibase.hooks.php" - ], - "psr-4": { - "Wikibase\\Client\\Tests\\": "client/tests/phpunit/includes", - "Wikibase\\Lib\\Tests\\": "lib/tests/phpunit", - "Wikibase\\View\\": "view/src", - "Wikibase\\View\\Tests\\": "view/tests/phpunit" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "The Wikidata team" - } - ], - "description": "Structured data repository for MediaWiki", - "homepage": "http://wikiba.se", - "keywords": [ - "wikibase", - "wikibaseclient", - "wikibaselib", - "wikibaserepo", - "wikidata" - ] - }, - { - "name": "wikibase/external-validation", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseQualityExternalValidation", - "reference": "be08e45df0f9021ec90442688fa4a9bfb0e221d1" - }, - "require": { - "data-values/common": ">=0.1 <0.4", - "data-values/geo": "~1.0", - "data-values/number": ">=0.1 <0.9", - "data-values/time": "~0.8", - "php": ">=5.5.0", - "serialization/serialization": "3.*,>=3.2.1", - "wikibase/data-model": "~4.2|~5.0|~6.0", - "wikibase/data-model-serialization": "~2.0", - "wikibase/data-model-services": "~2.0|~3.0" - }, - "require-dev": { - "phpunit/phpunit": "~3.7,>=3.7.37", - "satooshi/php-coveralls": "dev-master" - }, - "time": "2016-11-30 13:52:02", - "type": "mediawiki-extension", - "installation-source": "source", - "autoload": { - "psr-4": { - "WikibaseQuality\\ExternalValidation\\": "includes/", - "WikibaseQuality\\ExternalValidation\\Api\\": "api/", - "WikibaseQuality\\ExternalValidation\\Specials\\": "specials/", - "WikibaseQuality\\ExternalValidation\\Tests\\": "tests/phpunit/" - }, - "classmap": [ - "WikibaseQualityExternalValidationHooks.php", - "maintenance/UpdateExternalData.php" - ] - }, - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "BP2014N1" - } - ], - "description": "Extension for WikibaseQuality to perform cross-checks with external databases.", - "homepage": "https://www.mediawiki.org/wiki/WikidataQuality/", - "keywords": [ - "database", - "external", - "quality", - "trust", - "violation", - "wikibase", - "wikidata" - ], - "support": { - "issues": "https://phabricator.wikimedia.org/project/profile/1203/" - } - }, - { - "name": "wikibase/media-info", - "version": "dev-master", - "version_normalized": "9999999-dev", - "source": { - "type": "git", - "url": "https://gerrit.wikimedia.org/r/mediawiki/extensions/WikibaseMediaInfo", - "reference": "c7b71fdf31305500d8c57793f7cbd93c1f3a9705" - }, - "require": { - "php": ">=5.5.0", - "serialization/serialization": "~3.2", - "wikibase/data-model": "~6.1", - "wikibase/data-model-serialization": "~2.0", - "wikibase/data-model-services": "~3.6" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.6.0", - "phpunit/phpunit": "~4.8" - }, - "time": "2016-11-29 10:33:33", - "type": "mediawiki-extension", - "installation-source": "source", - "autoload": { - "psr-4": { - "Wikibase\\MediaInfo\\": "src/", - "Wikibase\\MediaInfo\\Tests\\": "tests/phpunit/composer/", - "Wikibase\\MediaInfo\\Tests\\MediaWiki\\": "tests/phpunit/mediawiki/" - } - }, - "scripts": { - "fix": [ - "phpcbf" - ], - "test": [ - "parallel-lint . --exclude vendor", - "phpcs -p -s", - "phpunit" - ] - }, - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "The Wikidata team" - } - ], - "description": "Wikibase extension to manage structured metadata of media files", - "homepage": "http://wikiba.se", - "support": { - "issues": "https://phabricator.wikimedia.org/", - "irc": "irc://irc.freenode.net/wikidata" } } ] diff --git a/vendor/wikibase/data-model/RELEASE-NOTES.md b/vendor/wikibase/data-model/RELEASE-NOTES.md index 367cf9e..b253442 100644 --- a/vendor/wikibase/data-model/RELEASE-NOTES.md +++ b/vendor/wikibase/data-model/RELEASE-NOTES.md @@ -1,5 +1,9 @@ # Wikibase DataModel release notes +## Version 6.3.1 (2016-11-30) + +* Fixed `ItemId` and `PropertyId` to allow calling getNumericId on foreign entity ids. + ## Version 6.3.0 (2016-11-03) * Added `RepositoryNameAssert` class diff --git a/vendor/wikibase/data-model/src/Entity/Int32EntityId.php b/vendor/wikibase/data-model/src/Entity/Int32EntityId.php index 6c93b13..d1a6b65 100644 --- a/vendor/wikibase/data-model/src/Entity/Int32EntityId.php +++ b/vendor/wikibase/data-model/src/Entity/Int32EntityId.php @@ -3,11 +3,11 @@ namespace Wikibase\DataModel\Entity; /** - * Interface for EntityIds that can be converted to a unique, positive, signed 32 bit integer in the - * range [1..2147483647], and back from the entity type and the number. When an ID can not be - * represented as an unique integer, an InvalidArgumentException must be thrown on construction - * time. For example, when "Q1" and "Q01" have the same integer representation, only one should be - * allowed. + * Interface for EntityIds that can be converted to a positive, signed 32 bit integer in the range + * [1..2147483647], and back from the entity type and the number. The number must be distinct for + * different IDs. When an ID can not be represented as a distinct integer, an + * InvalidArgumentException must be thrown on construction time. For example, when "Q1" and "Q01" + * have the same integer representation, only one should be allowed. * * Entity types that do not meet this criteria should not implement this interface. * @@ -26,7 +26,7 @@ /** * @since 6.1 * - * @return int Guaranteed to be a unique integer in the range [1..2147483647]. + * @return int Guaranteed to be a distinct integer in the range [1..2147483647]. */ public function getNumericId(); diff --git a/vendor/wikibase/data-model/src/Entity/ItemId.php b/vendor/wikibase/data-model/src/Entity/ItemId.php index ef3d53a..cc6675c 100644 --- a/vendor/wikibase/data-model/src/Entity/ItemId.php +++ b/vendor/wikibase/data-model/src/Entity/ItemId.php @@ -49,16 +49,13 @@ } /** - * @return int + * @see Int32EntityId::getNumericId * - * @throws RuntimeException if called on a foreign ID. + * @return int Guaranteed to be a distinct integer in the range [1..2147483647]. */ public function getNumericId() { - if ( $this->isForeign() ) { - throw new RuntimeException( 'getNumericId must not be called on foreign ItemIds' ); - } - - return (int)substr( $this->serialization, 1 ); + $serializationParts = self::splitSerialization( $this->serialization ); + return (int)substr( $serializationParts[2], 1 ); } /** diff --git a/vendor/wikibase/data-model/src/Entity/PropertyId.php b/vendor/wikibase/data-model/src/Entity/PropertyId.php index ed5e4ce..45f580b 100644 --- a/vendor/wikibase/data-model/src/Entity/PropertyId.php +++ b/vendor/wikibase/data-model/src/Entity/PropertyId.php @@ -49,16 +49,13 @@ } /** - * @return int + * @see Int32EntityId::getNumericId * - * @throws RuntimeException if called on a foreign ID. + * @return int Guaranteed to be a distinct integer in the range [1..2147483647]. */ public function getNumericId() { - if ( $this->isForeign() ) { - throw new RuntimeException( 'getNumericId must not be called on foreign PropertyIds' ); - } - - return (int)substr( $this->serialization, 1 ); + $serializationParts = self::splitSerialization( $this->serialization ); + return (int)substr( $serializationParts[2], 1 ); } /** diff --git a/vendor/wikibase/data-model/tests/unit/Entity/ItemIdTest.php b/vendor/wikibase/data-model/tests/unit/Entity/ItemIdTest.php index 0fc99c0..90d8de8 100644 --- a/vendor/wikibase/data-model/tests/unit/Entity/ItemIdTest.php +++ b/vendor/wikibase/data-model/tests/unit/Entity/ItemIdTest.php @@ -81,6 +81,11 @@ $this->assertSame( 1, $id->getNumericId() ); } + public function testGetNumericId_foreignId() { + $id = new ItemId( 'foo:Q1' ); + $this->assertSame( 1, $id->getNumericId() ); + } + public function testGetEntityType() { $id = new ItemId( 'Q1' ); $this->assertSame( 'item', $id->getEntityType() ); @@ -149,11 +154,6 @@ [ 2147483648 ], [ '2147483648' ], ]; - } - - public function testGetNumericIdThrowsExceptionOnForeignIds() { - $this->setExpectedException( RuntimeException::class ); - ( new ItemId( 'foo:Q42' ) )->getNumericId(); } } diff --git a/vendor/wikibase/data-model/tests/unit/Entity/PropertyIdTest.php b/vendor/wikibase/data-model/tests/unit/Entity/PropertyIdTest.php index 2494e55..39b399f 100644 --- a/vendor/wikibase/data-model/tests/unit/Entity/PropertyIdTest.php +++ b/vendor/wikibase/data-model/tests/unit/Entity/PropertyIdTest.php @@ -81,6 +81,11 @@ $this->assertSame( 1, $id->getNumericId() ); } + public function testGetNumericId_foreignId() { + $id = new PropertyId( 'foo:P1' ); + $this->assertSame( 1, $id->getNumericId() ); + } + public function testGetEntityType() { $id = new PropertyId( 'P1' ); $this->assertSame( 'property', $id->getEntityType() ); @@ -149,11 +154,6 @@ [ 2147483648 ], [ '2147483648' ], ]; - } - - public function testGetNumericIdThrowsExceptionOnForeignIds() { - $this->setExpectedException( RuntimeException::class ); - ( new PropertyId( 'foo:P42' ) )->getNumericId(); } } -- To view, visit https://gerrit.wikimedia.org/r/324686 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2a3314c8c2a795309dde7661dcc28b32d555ef2f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikidata Gerrit-Branch: master Gerrit-Owner: WikidataBuilder <wikidata-servi...@wikimedia.de> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits