WikidataBuilder has uploaded a new change for review. https://gerrit.wikimedia.org/r/205003
Change subject: New Wikidata Build - 2015-04-18T10:00:01+0000 ...................................................................... New Wikidata Build - 2015-04-18T10:00:01+0000 Change-Id: I8dc3dfa8534e4206401ab01ee37b34f1dcf947f8 --- M composer.lock M extensions/Wikibase/client/i18n/ast.json M extensions/Wikibase/client/i18n/eo.json M extensions/Wikibase/client/includes/api/PageTerms.php M extensions/Wikibase/client/includes/store/sql/DirectSqlStore.php M extensions/Wikibase/client/tests/phpunit/includes/api/ApiClientInfoTest.php M extensions/Wikibase/client/tests/phpunit/includes/api/PageTermsTest.php M extensions/Wikibase/lib/i18n/ast.json M extensions/Wikibase/lib/includes/formatters/WikibaseValueFormatterBuilders.php M extensions/Wikibase/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php M extensions/Wikibase/repo/i18n/ast.json M extensions/Wikibase/repo/i18n/eo.json M extensions/Wikibase/repo/i18n/ko.json M extensions/Wikibase/repo/i18n/yi.json M extensions/Wikibase/repo/includes/api/ApiErrorReporter.php M extensions/Wikibase/repo/includes/api/AvailableBadges.php M extensions/Wikibase/repo/includes/api/GetEntities.php M extensions/Wikibase/repo/includes/api/ParseValue.php M extensions/Wikibase/repo/includes/api/ResultBuilder.php M extensions/Wikibase/repo/includes/api/SearchEntities.php M extensions/Wikibase/repo/includes/api/SetClaim.php M extensions/Wikibase/repo/includes/specials/SpecialModifyTerm.php M extensions/Wikibase/repo/includes/specials/SpecialNewItem.php M extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php M extensions/Wikibase/repo/maintenance/pruneChanges.php M extensions/Wikibase/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/EntityTestHelper.php M extensions/Wikibase/repo/tests/phpunit/includes/api/FormatSnakValueTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/IndependentWikibaseApiTestCase.php M extensions/Wikibase/repo/tests/phpunit/includes/api/MergeItemsTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/ParseValueTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/SearchEntitiesTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/SetClaimTest.php M extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php M vendor/composer/installed.json 37 files changed, 341 insertions(+), 417 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata refs/changes/03/205003/1 diff --git a/composer.lock b/composer.lock index ebd44bd..fdc9935 100644 --- a/composer.lock +++ b/composer.lock @@ -1209,12 +1209,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "f92b90659be189dc37baa16e46a0e3a3ea3b186c" + "reference": "891e7b3285cebc3154012228fdb117e87742fd8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/f92b90659be189dc37baa16e46a0e3a3ea3b186c", - "reference": "f92b90659be189dc37baa16e46a0e3a3ea3b186c", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/891e7b3285cebc3154012228fdb117e87742fd8b", + "reference": "891e7b3285cebc3154012228fdb117e87742fd8b", "shasum": "" }, "require": { @@ -1282,7 +1282,7 @@ "wikibaserepo", "wikidata" ], - "time": "2015-04-16 21:25:02" + "time": "2015-04-18 01:24:08" }, { "name": "wikibase/wikimedia-badges", diff --git a/extensions/Wikibase/client/i18n/ast.json b/extensions/Wikibase/client/i18n/ast.json index 1e70b03..801debd 100644 --- a/extensions/Wikibase/client/i18n/ast.json +++ b/extensions/Wikibase/client/i18n/ast.json @@ -6,7 +6,6 @@ ] }, "wikibase-client-desc": "Cliente pa la estensión Wikibase", - "specialpages-group-wikibaseclient": "Cliente de {{WBREPONAME}}", "tooltip-t-wikibase": "Enllaz al elementu del depósitu de datos coneutáu", "wikibase-after-page-move": "Tamién pue [$1 anovar] l'elementu asociáu de {{WBREPONAME}} pa caltener los enllaces d'idioma na páxina treslladada.", "wikibase-after-page-move-queued": "L'[$1 elementu de {{WBREPONAME}}] asociáu con esta páxina pronto s'actualizará automáticamente.", @@ -44,6 +43,7 @@ "wikibase-rc-show-wikidata-pref": "Amosar les ediciones de {{WBREPONAME}} nos cambios recientes", "wikibase-rc-wikibase-edit-letter": "D", "wikibase-rc-wikibase-edit-title": "Edición de {{WBREPONAME}}", + "wikibase-replicationnote": "Tenga en cuenta que puen pasar dellos minutos fasta que los cambeos se vean en toles wikis", "wikibase-watchlist-show-changes-pref": "Amosar les ediciones de {{WBREPONAME}} na so llista de vixilancia", "wikibase-error-serialize-error": "Falló la serialización de los datos", "wikibase-error-invalid-entity-id": "La ID qu'escribió ye desconocida pal sistema. Por favor, use una ID d'entidá válida.", diff --git a/extensions/Wikibase/client/i18n/eo.json b/extensions/Wikibase/client/i18n/eo.json index dc8d4ab..4345927 100644 --- a/extensions/Wikibase/client/i18n/eo.json +++ b/extensions/Wikibase/client/i18n/eo.json @@ -15,7 +15,7 @@ "wikibase-comment-linked": "Vikidatuma ero estis ligita al ĉi tiu paĝo.", "wikibase-comment-unlink": "Ĉi tiu paĝo estis malligita de la Vikidatuma ero. La lingvaj ligiloj estas forigitaj.", "wikibase-comment-restore": "Ligita vikidatuma ero estis restarigita. La lingvaj ligiloj ankaŭ estis restarigitaj.", - "wikibase-comment-update": "Vikidatuma ero ĝisdatigita.", + "wikibase-comment-update": "Ero en {{WBREPONAME}} ĝisdatigita.", "wikibase-comment-sitelink-add": "Lingva ligilo aldonita: $1", "wikibase-comment-sitelink-change": "Lingva ligilo ŝanĝita de $1 al $2", "wikibase-comment-sitelink-remove": "Lingva ligilo forigita: $1", diff --git a/extensions/Wikibase/client/includes/api/PageTerms.php b/extensions/Wikibase/client/includes/api/PageTerms.php index 9f84f1e..0702691 100644 --- a/extensions/Wikibase/client/includes/api/PageTerms.php +++ b/extensions/Wikibase/client/includes/api/PageTerms.php @@ -218,7 +218,7 @@ * @return bool True if it fits in the result */ private function addTermsForPage( ApiResult $result, $pageId, array $termsByType ) { - $result->setIndexedTagName_recursive( $termsByType, 'term' ); + ApiResult::setIndexedTagNameRecursive( $termsByType, 'term' ); $fit = $result->addValue( array( 'query', 'pages', $pageId ), 'terms', $termsByType ); diff --git a/extensions/Wikibase/client/includes/store/sql/DirectSqlStore.php b/extensions/Wikibase/client/includes/store/sql/DirectSqlStore.php index 35e1704..2915d5c 100644 --- a/extensions/Wikibase/client/includes/store/sql/DirectSqlStore.php +++ b/extensions/Wikibase/client/includes/store/sql/DirectSqlStore.php @@ -59,12 +59,12 @@ private $repoWiki; /** - * @var ConnectionManager|null + * @var ConsistentReadConnectionManager|null */ private $repoConnectionManager = null; /** - * @var ConnectionManager|null + * @var ConsistentReadConnectionManager|null */ private $localConnectionManager = null; @@ -203,7 +203,7 @@ * Returns a LoadBalancer that acts as a factory for connections to the repo wiki's * database. * - * @return ConnectionManager + * @return ConsistentReadConnectionManager */ private function getRepoConnectionManager() { if ( $this->repoConnectionManager === null ) { @@ -217,7 +217,7 @@ * Returns a LoadBalancer that acts as a factory for connections to the local (client) wiki's * database. * - * @return ConnectionManager + * @return ConsistentReadConnectionManager */ private function getLocalConnectionManager() { if ( $this->localConnectionManager === null ) { diff --git a/extensions/Wikibase/client/tests/phpunit/includes/api/ApiClientInfoTest.php b/extensions/Wikibase/client/tests/phpunit/includes/api/ApiClientInfoTest.php index 66dc746..b6dce87 100644 --- a/extensions/Wikibase/client/tests/phpunit/includes/api/ApiClientInfoTest.php +++ b/extensions/Wikibase/client/tests/phpunit/includes/api/ApiClientInfoTest.php @@ -66,7 +66,7 @@ $module = $this->getApiModule( $params, $settings ); $module->execute(); - $result = $module->getResult()->getData(); + $result = $module->getResult()->getResultData(); $this->assertInternalType( 'array', $result, 'top level element is an array' ); diff --git a/extensions/Wikibase/client/tests/phpunit/includes/api/PageTermsTest.php b/extensions/Wikibase/client/tests/phpunit/includes/api/PageTermsTest.php index fe6124f..45bce78 100644 --- a/extensions/Wikibase/client/tests/phpunit/includes/api/PageTermsTest.php +++ b/extensions/Wikibase/client/tests/phpunit/includes/api/PageTermsTest.php @@ -237,7 +237,12 @@ $module->execute(); $result = $module->getResult(); - return $result->getData(); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + return $data; } public function pageTermsProvider() { diff --git a/extensions/Wikibase/lib/i18n/ast.json b/extensions/Wikibase/lib/i18n/ast.json index 1ae0662..56dc832 100644 --- a/extensions/Wikibase/lib/i18n/ast.json +++ b/extensions/Wikibase/lib/i18n/ast.json @@ -70,6 +70,12 @@ "datatypes-type-wikibase-item": "Elementu", "datatypes-type-commonsMedia": "Ficheru multimedia de Commons", "version-wikibase": "Wikibase", + "wikibase-time-precision-Gannum": "en $1 miles de millones d'años", + "wikibase-time-precision-Mannum": "en $1 millones d'años", + "wikibase-time-precision-annum": "en $1 años", + "wikibase-time-precision-millennium": "$1. mileniu", + "wikibase-time-precision-century": "$1. sieglu", + "wikibase-time-precision-10annum": "$1 décaes", "wikibase-snakformatter-valuetype-mismatch": "El tipu de valor \"$1\" nun casa col tipu de propiedá \"$2\".", "wikibase-snakformatter-property-not-found": "Nun s'alcontró la propiedá $1, nun pudo determinase'l tipu de datos a usar." } diff --git a/extensions/Wikibase/lib/includes/formatters/WikibaseValueFormatterBuilders.php b/extensions/Wikibase/lib/includes/formatters/WikibaseValueFormatterBuilders.php index d31f8cd..15c84ad 100644 --- a/extensions/Wikibase/lib/includes/formatters/WikibaseValueFormatterBuilders.php +++ b/extensions/Wikibase/lib/includes/formatters/WikibaseValueFormatterBuilders.php @@ -287,6 +287,8 @@ * @return DispatchingValueFormatter */ public function buildDispatchingValueFormatter( OutputFormatValueFormatterFactory $factory, $format, FormatterOptions $options ) { + $this->applyLanguageDefaults( $options ); + switch ( $format ) { case SnakFormatter::FORMAT_PLAIN: $formatters = $this->getPlainTextFormatters( $options ); diff --git a/extensions/Wikibase/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php b/extensions/Wikibase/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php index b4cb9a8..331dfc1 100644 --- a/extensions/Wikibase/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php +++ b/extensions/Wikibase/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php @@ -155,6 +155,12 @@ new EntityIdValue( new ItemId( 'Q5' ) ), '@^Label for Q5$@' // compare mock object created in newBuilders() ), + 'plain item label (with language fallback)' => array( + SnakFormatter::FORMAT_PLAIN, + $this->newFormatterOptions( 'de-ch' ), // should fall back to 'de' + new EntityIdValue( new ItemId( 'Q5' ) ), + '@^Name für Q5$@' // compare mock object created in newBuilders() + ), 'widget item link (with entity lookup)' => array( SnakFormatter::FORMAT_HTML_WIDGET, $this->newFormatterOptions(), diff --git a/extensions/Wikibase/repo/i18n/ast.json b/extensions/Wikibase/repo/i18n/ast.json index 1f9be32..24851ea 100644 --- a/extensions/Wikibase/repo/i18n/ast.json +++ b/extensions/Wikibase/repo/i18n/ast.json @@ -18,10 +18,10 @@ "wikibase-addreference": "amestar referencia", "wikibase-save-inprogress": "Guardando...", "wikibase-remove-inprogress": "Desaniciando...", - "wikibase-label-empty": "Inda nun ta definida denguna etiqueta", + "wikibase-label-empty": "Nun ta definida denguna etiqueta", "wikibase-label-edit-placeholder": "escriba la etiqueta", "wikibase-label-edit-placeholder-language-aware": "escriba la etiqueta en $1", - "wikibase-description-empty": "Inda nun ta definida denguna descripción", + "wikibase-description-empty": "Nun ta definida denguna descripción", "wikibase-description-edit-placeholder": "escriba la descripción", "wikibase-description-edit-placeholder-language-aware": "escriba la descripción en $1", "wikibase-diffview-reference": "referencia", @@ -138,19 +138,16 @@ "wikibase-setlabel-intro": "Esti formulariu permite definir la etiqueta d'una entidá. Tien de dar el ID de la entidá (p. ex. Q23), un códigu d'idioma (p. ex. \"ast\") y la etiqueta a definir.", "wikibase-setlabel-label": "Etiqueta:", "wikibase-setlabel-submit": "Definir la etiqueta", - "wikibase-setlabel-warning-remove": "¿Realmente quier desaniciar la etiqueta de [[$1]]?", "special-setdescription": "Definir una descripción", "wikibase-setdescription-introfull": "Ta definiendo la descripción en $2 pa [[$1]].", "wikibase-setdescription-intro": "Esti formulariu permite definir la descripción d'una entidá. Tien de dar el ID de la entidá (p. ex. Q23), un códigu d'idioma (p. ex. \"ast\") y la etiqueta a definir.", "wikibase-setdescription-label": "Descripción:", "wikibase-setdescription-submit": "Definir la descripción", - "wikibase-setdescription-warning-remove": "¿Realmente quier desaniciar la descripción de [[$1]]?", "special-setaliases": "Definir alcuños", "wikibase-setaliases-introfull": "Ta definiendo los alcuños en $2 pa [[$1]]. Puen separase dellos alcuños col caráuter barra vertical (<code>|</code>).", "wikibase-setaliases-intro": "Esti formulariu permite definir los alcuños d'una entidá. Tien de dar el ID de la entidá (p. ex. Q23), un códigu d'idioma (p. ex. \"ast\") y los alcuños a definir. Puen separase dellos alcuños col caráuter barra vertical (<code>|</code>).", "wikibase-setaliases-label": "Alcuños:", "wikibase-setaliases-submit": "Definir los alcuños", - "wikibase-setaliases-warning-remove": "¿Realmente quier desaniciar tolos alcuños de [[$1]]?", "special-setsitelink": "Definir un enllaz de sitiu", "wikibase-setsitelink-introfull": "Ta definiendo l'enllaz de sitiu de $2 pa [[$1]].", "wikibase-setsitelink-intro": "Esti formulariu permite definir l'enllaz de sitiu d'un elementu. Tien de dar el ID del elementu (p. ex. Q23), una id de sitiu (p. ex. \"enwiki\") y l'enllaz de sitiu a definir.", @@ -158,7 +155,6 @@ "wikibase-setsitelink-label": "Enllaz del sitiu:", "wikibase-setsitelink-badges": "Insinies:", "wikibase-setsitelink-submit": "Definir l'enllaz del sitiu", - "wikibase-setsitelink-warning-remove": "¿Realmente quier desaniciar l'enllaz de sitiu de [[$1]]?", "wikibase-setsitelink-invalid-site": "La id del sitiu \"$1\" ye desconocida. Por favor, use una id de sitiu esistente, como \"astwiki\".", "wikibase-setsitelink-not-item": "La id $1 nun pertenez a nengún elementu.", "wikibase-setsitelink-not-badge": "L'elementu $1 nun ye una insinia.", diff --git a/extensions/Wikibase/repo/i18n/eo.json b/extensions/Wikibase/repo/i18n/eo.json index cf96b65..e68c779 100644 --- a/extensions/Wikibase/repo/i18n/eo.json +++ b/extensions/Wikibase/repo/i18n/eo.json @@ -28,7 +28,7 @@ "wikibase-label-empty": "Neniu etikedo difinita", "wikibase-label-edit-placeholder": "entajpi etikedon", "wikibase-label-edit-placeholder-language-aware": "entajpi etikedon en $1", - "wikibase-description-empty": "Neniu priskribo jam difinita", + "wikibase-description-empty": "Neniu priskribo difinita", "wikibase-description-edit-placeholder": "entajpi priskribon", "wikibase-description-edit-placeholder-language-aware": "entajpu priskribon en $1", "wikibase-diffview-reference": "referenco", @@ -74,7 +74,7 @@ "wikibase-statementview-rank-preferred": "Preferata rango", "wikibase-statementview-rank-normal": "Normala rango", "wikibase-statementview-rank-deprecated": "Malpreferata rango", - "wikibase-statementview-referencesheading-pendingcountersubject": "{{PLURAL:$1|fonto|fontoj}}", + "wikibase-statementview-referencesheading-pendingcountersubject": "{{PLURAL:$1|referenco|referencoj}}", "wikibase-statementview-referencesheading-pendingcountertooltip": "{{PLURAL:$1|Unu fonto|$1 fontoj}} ankoraŭ ne konservita{{PLURAL:$1||j}}", "wikibase-snakview-property-input-placeholder": "atributo", "wikibase-snakview-choosesnaktype": "Elektu specon de valoro.", @@ -133,13 +133,10 @@ "wikibase-setlabel-intro": "Ĉi tiu formularo ebligas krei etikedon por ero. Vi provizu la ID-on de la ero (ekz. Q123) lingvokodon (ekz eo), kaj la kreendan etikedon.", "wikibase-setlabel-label": "Etikedo:", "wikibase-setlabel-submit": "Kreu etikedon", - "wikibase-setlabel-warning-remove": "Ĉu vi vere volas forigi etikedon de [[$1]]?", "special-setdescription": "Aldoni priskribon", "wikibase-setdescription-label": "Priskribo:", "wikibase-setdescription-submit": "Aldoni priskribon", - "wikibase-setdescription-warning-remove": "Ĉu vi vere volas forigi la priskribon de [[$1]]?", "wikibase-setaliases-label": "Kromnomoj:", - "wikibase-setaliases-warning-remove": "Ĉu vi vere volas forigi ĉiujn kromnomojn de [[$1]]?", "wikibase-setsitelink-site": "Identigilo de retejo:", "wikibase-setsitelink-label": "Reteja ligilo:", "wikibase-setsitelink-badges": "Insignoj:", diff --git a/extensions/Wikibase/repo/i18n/ko.json b/extensions/Wikibase/repo/i18n/ko.json index d15e443..99e901e 100644 --- a/extensions/Wikibase/repo/i18n/ko.json +++ b/extensions/Wikibase/repo/i18n/ko.json @@ -114,6 +114,12 @@ "wikibase-itembytitle-lookup-page": "문서:", "wikibase-itembytitle-submit": "검색", "wikibase-itembytitle-create": "또한 [$1 항목을 만들] 수 있습니다.", + "special-gotolinkedpage": "링크된 문서로 이동", + "wikibase-gotolinkedpage-lookup-fieldset": "사이트와 항목을 통해 링크된 페이지로 이동", + "wikibase-gotolinkedpage-lookup-site": "사이트:", + "wikibase-gotolinkedpage-lookup-item": "항목 ID:", + "wikibase-gotolinkedpage-submit": "가기", + "wikibase-gotolinkedpage-summary": "Special:GoToLinkedPage는 항목으로 연결된 사이트에 있는 문서를 찾는 데 사용됩니다.<br /> 왼쪽 칸의 \"사이트:\"에는 언어나 사이트 코드를 입력하는 곳입니다.<br /> 오른쪽 칸의 \"항목 ID:\"에는 당신이 찾고자 하는 문서에 해당하는 위키데이터 항목의 ID를 입력하셔야 합니다.", "special-itemdisambiguation": "항목 동음이의어", "wikibase-itemdisambiguation-lookup-fieldset": "언어와 레이블별로 항목 검색", "wikibase-itemdisambiguation-lookup-language": "언어 코드:", @@ -122,8 +128,9 @@ "wikibase-itemdisambiguation-nothing-found": "죄송합니다, 해당 레이블이 있는 항목을 찾을 수 없습니다.", "wikibase-itemdisambiguation-search": "당신은 [$1 해당 항목을 검색할 수 있습니다].", "wikibase-itemdisambiguation-create": "또한 [$1 항목을 만들] 수 있습니다.", - "wikibase-itemdisambiguation-invalid-langcode": "죄송합니다, 제공한 언어 식별자는 시스템에서 알 수 없습니다. \"ko\"와 같은 올바른 식별자를 사용하세요.", + "wikibase-itemdisambiguation-invalid-langcode": "죄송합니다, 당신이 입력한 언어 코드는 시스템에서 알 수 없습니다. \"ko\"와 같은 올바른 언어 코드를 사용하세요.", "wikibase-itemdisambiguation-description": "검색에 사용되는 값은 완전한 텍스트 항목이어야 합니다. 언어는 \"ko\"와 같은 식별자입니다.", + "wikibase-itemdisambiguation-summary": "정확히 같은 레이블을 가진 모든 항목을 찾습니다.", "special-newproperty": "새 속성 만들기", "wikibase-newproperty-summary": "[[Special:PropertyDisambiguation|속성이 이미 존재하는지 확인]]해야 합니다!<br />모든 새 속성에 대한 [[Help:Label|레이블]]과 [[Help:Description|설명]]을 만들어야 하며 더 많은 올바른 속성 유형이어야 합니다.", "wikibase-newproperty-fieldset": "새 속성 만들기", @@ -135,7 +142,7 @@ "wikibase-newitem-site": "첫 링크한 문서의 사이트", "wikibase-newitem-page": "첫 링크한 문서의 이름", "wikibase-newitem-no-external-page": "지정한 문서는 해당 사이트에서 찾을 수 없습니다.", - "wikibase-newitem-not-recognized-siteid": "지정한 사이트 식별자는 인식하지 않았습니다.", + "wikibase-newitem-not-recognized-siteid": "지정한 사이트 식별자는 인식되지 않았습니다.", "wikibase-newentity-label": "레이블:", "wikibase-newentity-description": "설명:", "wikibase-newentity-submit": "만들기", @@ -228,11 +235,12 @@ "wikibase-restoreold": "복구", "wikibase-restore-summary": "[[Special:Contributions/$2|$2]] 사용자에 의해 $1 판을 복구함", "wikibase-no-direct-editing": "$1 이름공간에서 직접 편집은 비활성화되어 있습니다.", - "wikibase-noentity": "이 데이터 집합이 존재하지 않습니다.\n<span class=\"plainlinks\">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} 관련 기록을 검색할]</span> 수 있습니다.", + "wikibase-noentity": "이 객체가 존재하지 않습니다. 이 객체가 어떻게 되었는지 [{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} 관련 기록을 검색할] 수 있습니다.", "wikibase-noentity-createone": "또한 [[$1|새 항목을 만들 수 있습니다]].", "wikibase-special-mergeitems-error-prefix": "항목을 병합할 수 없습니다. 다음 오류가 발생했습니다:", "wikibase-item-summary-wbsetitem": "새 항목을 만듦", "wikibase-item-summary-wbcreate-new": "새 항목을 만듦", + "wikibase-item-summary-wbcreateredirect": "$4로 넘겨줌", "wikibase-item-summary-wbeditentity": "새 항목을 만듦", "wikibase-item-summary-wbeditentity-create": "새 항목을 만듦", "wikibase-item-summary-wbeditentity-update": "항목을 바꿈", @@ -274,6 +282,7 @@ "wikibase-item-summary-wbsetclaim-update-references": "{{PLURAL:$3|주장}}의 {{PLURAL:$4|참고 한 개|참고 $4개}}을 바꿈", "wikibase-item-summary-wbsetclaim-update-rank": "{{PLURAL:$3|주장}}의 등급을 바꿈", "wikibase-item-summary-clientsitelink-update": "페이지를 [$3]에서 [$4](으)로 옮김", + "wikibase-item-summary-clientsitelink-remove": "[$3]의 문서 삭제됨", "wikibase-item-summary-wbsetqualifier-add": "{{PLURAL:$1|한정어}}를 추가함", "wikibase-item-summary-wbsetqualifier-update": "{{PLURAL:$1|한정어}}를 바꿈", "wikibase-item-summary-wbremovequalifiers-remove": "{{PLURAL:$1|한정어}}를 제거함", @@ -316,12 +325,15 @@ "wikibase-listdatatypes-time-body": "시간 값에 대한 리터럴 데이터 필드입니다. 약간의 정밀도와 경계로 된 시간으로 주어집니다. 내부에서는 시간이 항상 선발 그레고리력 형식으로 저장되어 있지만 다른 형식도 입력 및 출력 시에 사용할 수 있습니다.(?)\n* time – 어느 시점을 나타내는 명시적인 값으로 ISO8601에 따라 표현되고 년은 항상 11 자리에서 날짜는 항상 부호가 붙으며, +00000002013-01-01T00:00:00Z 형식입니다\n* timezone – 부호가 있는 정수로 명시적인 값입니다. UTC로부터의 오프셋을 분에 지정된 시간대 정보입니다.\n* before – 지정된 시간부터 현재까지 단위 시간에 얼마나 많은 분이 걸리는지 나타내는 명시적인 정수 값입니다. 단위는 precision으로 주어집니다.\n* after – 지정된 시간까지 현재에서 단위 시간에 얼마나 많은 분이 걸리는지 나타내는 명시적인 정수 값입니다. 단위는 precision으로 주어집니다.\n* precision – shortint 형식의 명시적인 값입니다. 수는 다음과 같은 의미가 있습니다: 0 - 10억 년, 1 - 1억 년, ..., 6 - 천 년, 7 - 1세기, 8 - 10년, 9 - 1년, 10 - 월, 11 - 일, 12 - 시, 13 - 분, 14 - 초.\n* calendarmodel – URI로 지정된 명시적인 값입니다. 시간을 표시하는데 사용되어야 하는 역법을 식별합니다.", "wikibase-listdatatypes-url-head": "URL", "wikibase-listdatatypes-url-body": "URL에 대한 리터럴 데이터 필드입니다. URL은 또한 위키텍스트의 바깥 링크에 대해 지원되는 프로토콜로 제한됩니다.", + "wikibase-concept-uri": "개념 URI", + "wikibase-add-badges": "배지 추가", "datatypes-type-url": "URL", "content-model-wikibase-item": "위키베이스 항목", "content-model-wikibase-property": "위키베이스 속성", "content-model-wikibase-query": "위키베이스 쿼리", "right-item-term": "항목 용어 바꾸기 (레이블, 설명, 별명)", "right-item-merge": "항목 병합", + "right-item-redirect": "항목 넘겨주기를 생성하기", "right-property-term": "속성 용어 바꾸기 (레이블, 설명, 별명)", "right-property-create": "속성 만들기" } diff --git a/extensions/Wikibase/repo/i18n/yi.json b/extensions/Wikibase/repo/i18n/yi.json index c2fcfb7..cfba16f 100644 --- a/extensions/Wikibase/repo/i18n/yi.json +++ b/extensions/Wikibase/repo/i18n/yi.json @@ -18,7 +18,12 @@ "wikibase-save-inprogress": "אויפֿהיטן אין גאנג…", "wikibase-remove-inprogress": "אוועקנעמען אין גאנג…", "wikibase-entitytermsview-entitytermsforlanguagelistview-toggler": "אין נאך שפראַכן", + "wikibase-entitytermsview-entitytermsforlanguagelistview-configure-link-label": "קאנפיגורירן", + "wikibase-setting-entitytermsview-showEntitytermslistview": "ווײַזן באצייכענונגען, אליאסף און באשרײַבונגען אין אלע מײַנע שפראכן ביים לאדן דעם בלאט", + "wikibase-entitytermsforlanguagelistview-aliases": "אויך באקאנט ווי", + "wikibase-entitytermsforlanguagelistview-description": "באַשרײַבונג", "wikibase-entitytermsforlanguagelistview-label": "באצייכענונג", + "wikibase-entitytermsforlanguagelistview-language": "שפראַך", "wikibase-label-empty": "קיין באצייכענונג נישט דעפֿינירט", "wikibase-label-edit-placeholder": "אריינגעבן באצייכענונג", "wikibase-label-edit-placeholder-language-aware": "אײַנגעבן באצייכענונג אויף $1", @@ -27,6 +32,7 @@ "wikibase-description-edit-placeholder-language-aware": "אײַנגעבן שילדערונג אין $1", "wikibase-diffview-reference": "רעפערענץ", "wikibase-diffview-rank": "ראנג", + "wikibase-diffview-rank-normal": "נארמאלער ראנג", "wikibase-diffview-qualifier": "באדינגונג", "wikibase-diffview-label": "באצייכענונג", "wikibase-diffview-alias": "אליאסן", @@ -92,6 +98,8 @@ "wikibase-itembytitle-lookup-page": "בלאט:", "wikibase-itembytitle-submit": "זוכן", "wikibase-itembytitle-create": "איר קענט אויך [$1 שאפֿן א דאטנאביעקט].", + "wikibase-gotolinkedpage-lookup-site": "וועבזײַטל:", + "wikibase-gotolinkedpage-submit": "גיין", "special-itemdisambiguation": "אביעקט אויפֿקלערונג", "wikibase-itemdisambiguation-lookup-fieldset": "זוכן דאטנאביעקטן לויט שפראך און צייכענונג", "wikibase-itemdisambiguation-lookup-language": "שפראַך קאד:", @@ -123,6 +131,9 @@ "special-setaliases": "שטעלן אליאסן", "wikibase-setaliases-label": "אליאסן:", "wikibase-setaliases-submit": "שטעלן די אליאסן", + "wikibase-setlabeldescriptionaliases-label-label": "באצייכענונג:", + "wikibase-setlabeldescriptionaliases-description-label": "באַשרײַבונג:", + "wikibase-setlabeldescriptionaliases-aliases-label": "אליאסן:", "special-setsitelink": "שטעלן א וועבזייטל לינק", "wikibase-setsitelink-introfull": "איר שטעלט דעם וועבזייטל לינק פון $2 פֿאר [[$1]].", "wikibase-modifyentity-id": "אידענטיפֿיצירער", diff --git a/extensions/Wikibase/repo/includes/api/ApiErrorReporter.php b/extensions/Wikibase/repo/includes/api/ApiErrorReporter.php index 330ad17..9ad77b5 100644 --- a/extensions/Wikibase/repo/includes/api/ApiErrorReporter.php +++ b/extensions/Wikibase/repo/includes/api/ApiErrorReporter.php @@ -308,13 +308,11 @@ $messageData = $this->convertMessageToResult( $message ); - $res = $this->apiModule->getResult(); - $messageList = isset( $data['messages'] ) ? $data['messages'] : array(); - $res->setIndexedTagName( $messageList, 'message' ); + ApiResult::setIndexedTagName( $messageList, 'message' ); $messageList[] = $messageData; - $res->setElement( $data, 'messages', $messageList, ApiResult::OVERRIDE ); + ApiResult::setValue( $data, 'messages', $messageList, ApiResult::OVERRIDE ); } /** @@ -365,7 +363,6 @@ */ private function convertMessagesToResult( array $messageSpecs ) { $result = array(); - $res = $this->apiModule->getResult(); foreach ( $messageSpecs as $message ) { $type = null; @@ -385,13 +382,13 @@ $row = $this->convertMessageToResult( $message ); if ( $type !== null ) { - $res->setElement( $row, 'type', $type ); + ApiResult::setValue( $row, 'type', $type ); } $result[] = $row; } - $res->setIndexedTagName( $result, 'message' ); + ApiResult::setIndexedTagName( $result, 'message' ); return $result; } @@ -433,19 +430,18 @@ * @return array */ private function convertMessageToResult( Message $message ) { - $res = $this->apiModule->getResult(); - $name = $message->getKey(); $params = $message->getParams(); $row = array(); - $res->setElement( $row, 'name', $name ); + ApiResult::setValue( $row, 'name', $name ); - $res->setElement( $row, 'parameters', $params ); - $res->setIndexedTagName( $row['parameters'], 'parameter' ); + ApiResult::setValue( $row, 'parameters', $params ); + ApiResult::setIndexedTagName( $row['parameters'], 'parameter' ); $html = $this->forceMessageLanguage( $message, $this->language )->useDatabase( true )->parse(); - $res->setContent( $row, $html, 'html' ); + ApiResult::setContentValue( $row, 'html', $html ); + $row[ApiResult::META_BC_SUBELEMENTS][] = 'html'; return $row; } diff --git a/extensions/Wikibase/repo/includes/api/AvailableBadges.php b/extensions/Wikibase/repo/includes/api/AvailableBadges.php index cee6e6e..90d6cd9 100644 --- a/extensions/Wikibase/repo/includes/api/AvailableBadges.php +++ b/extensions/Wikibase/repo/includes/api/AvailableBadges.php @@ -3,6 +3,7 @@ namespace Wikibase\Api; use ApiBase; +use ApiResult; use Wikibase\Repo\WikibaseRepo; /** @@ -24,7 +25,7 @@ public function execute() { $settings = WikibaseRepo::getDefaultInstance()->getSettings(); $badgeItems = array_keys( $settings->getSetting( 'badgeItems' ) ); - $this->getResult()->setIndexedTagName( $badgeItems, 'badge' ); + ApiResult::setIndexedTagName( $badgeItems, 'badge' ); $this->getResult()->addValue( null, 'badges', diff --git a/extensions/Wikibase/repo/includes/api/GetEntities.php b/extensions/Wikibase/repo/includes/api/GetEntities.php index f2fb28b..02ca61d 100644 --- a/extensions/Wikibase/repo/includes/api/GetEntities.php +++ b/extensions/Wikibase/repo/includes/api/GetEntities.php @@ -100,9 +100,7 @@ } //todo remove once result builder is used... (what exactly does this do....?) - if ( $this->getResult()->getIsRawMode() ) { - $this->getResult()->setIndexedTagName_internal( array( 'entities' ), 'entity' ); - } + $this->getResult()->addIndexedTagName( array( 'entities' ), 'entity' ); $this->getResultBuilder()->markSuccess( 1 ); } diff --git a/extensions/Wikibase/repo/includes/api/ParseValue.php b/extensions/Wikibase/repo/includes/api/ParseValue.php index a6f9d69..591a46d 100644 --- a/extensions/Wikibase/repo/includes/api/ParseValue.php +++ b/extensions/Wikibase/repo/includes/api/ParseValue.php @@ -3,6 +3,7 @@ namespace Wikibase\Api; use ApiBase; +use ApiResult; use DataValues\DataValue; use LogicException; use OutOfBoundsException; @@ -110,7 +111,7 @@ } private function outputResults( array $results ) { - $this->getResult()->setIndexedTagName( $results, 'result' ); + ApiResult::setIndexedTagName( $results, 'result' ); $this->getResult()->addValue( null, diff --git a/extensions/Wikibase/repo/includes/api/ResultBuilder.php b/extensions/Wikibase/repo/includes/api/ResultBuilder.php index a6425ea..2a3d049 100644 --- a/extensions/Wikibase/repo/includes/api/ResultBuilder.php +++ b/extensions/Wikibase/repo/includes/api/ResultBuilder.php @@ -138,7 +138,7 @@ unset( $values['_element'] ); $values = array_values( $values ); - $this->result->setIndexedTagName( $values, $tag ); + ApiResult::setIndexedTagName( $values, $tag ); } $this->result->addValue( $path, $name, $values ); @@ -203,10 +203,7 @@ } $this->result->addValue( $path, $key, $value ); - - if ( $this->result->getIsRawMode() && !is_string( $key ) ) { - $this->result->setIndexedTagName_internal( $path, $tag ); - } + $this->result->addIndexedTagName( $path, $tag ); } /** diff --git a/extensions/Wikibase/repo/includes/api/SearchEntities.php b/extensions/Wikibase/repo/includes/api/SearchEntities.php index 9d0ac12..0ad634b 100644 --- a/extensions/Wikibase/repo/includes/api/SearchEntities.php +++ b/extensions/Wikibase/repo/includes/api/SearchEntities.php @@ -4,6 +4,7 @@ use ApiBase; use ApiMain; +use ApiResult; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdParsingException; @@ -344,7 +345,7 @@ if ( preg_match( $termPattern, $term->getText() ) ) { if ( !isset( $entry['aliases'] ) ) { $entry['aliases'] = array(); - $this->getResult()->setIndexedTagName( $entry['aliases'], 'alias' ); + ApiResult::setIndexedTagName( $entry['aliases'], 'alias' ); } $entry['aliases'][] = $term->getText(); $bestLangPerSlot[$key][$type] = $currentLang; @@ -411,7 +412,7 @@ $entries ); - $this->getResult()->setIndexedTagName_internal( array( 'search' ), 'entity' ); + $this->getResult()->addIndexedTagName( array( 'search' ), 'entity' ); // @todo use result builder? $this->getResult()->addValue( diff --git a/extensions/Wikibase/repo/includes/api/SetClaim.php b/extensions/Wikibase/repo/includes/api/SetClaim.php index dde9ac9..312fbd3 100644 --- a/extensions/Wikibase/repo/includes/api/SetClaim.php +++ b/extensions/Wikibase/repo/includes/api/SetClaim.php @@ -15,6 +15,7 @@ use Wikibase\ChangeOp\ClaimChangeOpFactory; use Wikibase\ClaimSummaryBuilder; use Wikibase\DataModel\Claim\Claim; +use Wikibase\DataModel\Claim\ClaimGuidParsingException; use Wikibase\DataModel\Claim\Claims; use Wikibase\DataModel\Entity\Entity; use Wikibase\Lib\Serializers\SerializerFactory; @@ -64,7 +65,11 @@ $this->dieError( 'GUID must be set when setting a claim', 'invalid-claim' ); } - $claimGuid = $this->claimGuidParser->parse( $guid ); + try { + $claimGuid = $this->claimGuidParser->parse( $guid ); + } catch ( ClaimGuidParsingException $ex ) { + $this->dieException( $ex, 'invalid-claim' ); + } $entityId = $claimGuid->getEntityId(); $baseRevisionId = isset( $params['baserevid'] ) ? intval( $params['baserevid'] ) : null; diff --git a/extensions/Wikibase/repo/includes/specials/SpecialModifyTerm.php b/extensions/Wikibase/repo/includes/specials/SpecialModifyTerm.php index 4914573..81eed13 100644 --- a/extensions/Wikibase/repo/includes/specials/SpecialModifyTerm.php +++ b/extensions/Wikibase/repo/includes/specials/SpecialModifyTerm.php @@ -128,7 +128,7 @@ // If the user just enters an item id and a language, dont remove the term. // The user can remove the term in the second form where it has to be // actually removed. This prevents users from removing terms accidentally. - if ( $request->getVal( 'remove' ) === null && $this->value === '' ) { + if ( !$request->getCheck( 'remove' ) && $this->value === '' ) { $this->value = null; return false; } diff --git a/extensions/Wikibase/repo/includes/specials/SpecialNewItem.php b/extensions/Wikibase/repo/includes/specials/SpecialNewItem.php index fa4497f..3b34eff 100644 --- a/extensions/Wikibase/repo/includes/specials/SpecialNewItem.php +++ b/extensions/Wikibase/repo/includes/specials/SpecialNewItem.php @@ -40,8 +40,8 @@ protected function prepareArguments() { parent::prepareArguments(); - $this->site = $this->getRequest()->getVal( 'site', null ); - $this->page = $this->getRequest()->getVal( 'page', null ); + $this->site = $this->getRequest()->getVal( 'site' ); + $this->page = $this->getRequest()->getVal( 'page' ); } /** diff --git a/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php b/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php index 9eee06a..b8c6188 100644 --- a/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php +++ b/extensions/Wikibase/repo/includes/specials/SpecialSetSiteLink.php @@ -145,7 +145,7 @@ // If the user just enters an item id and a site, dont remove the site link. // The user can remove the site link in the second form where it has to be // actually removed. This prevents users from removing site links accidentally. - if ( $request->getVal( 'remove' ) === null && $this->page === '' ) { + if ( !$request->getCheck( 'remove' ) && $this->page === '' ) { $this->page = null; return false; } diff --git a/extensions/Wikibase/repo/maintenance/pruneChanges.php b/extensions/Wikibase/repo/maintenance/pruneChanges.php index 6577d02..0cdd623 100644 --- a/extensions/Wikibase/repo/maintenance/pruneChanges.php +++ b/extensions/Wikibase/repo/maintenance/pruneChanges.php @@ -32,11 +32,6 @@ */ private $ignoreDispatch = false; - /** - * @var int The amount of rows to delete at once. - */ - private $pruneLimit = 0; - public function __construct() { parent::__construct(); $this->mDescription = "Prune the Wikibase changes table to a maximum number of entries"; @@ -47,13 +42,13 @@ $this->addOption( 'keep-minutes', 'Keep changes at least N minutes.', false, true, 'm' ); $this->addOption( 'grace-minutes', 'Keep changes at least N more minutes after they have been dispatched.', false, true, 'g' ); - $this->addOption( 'limit', 'Only prune up to N rows at once.', false, true, 'l' ); - $this->addOption( 'force', 'Run regardless of whether the PID file says it is running already.', false, false, 'f' ); $this->addOption( 'ignore-dispatch', 'Ignore whether changes have been dispatched or not.', false, false, 'D' ); + + $this->setBatchSize( 500 ); } public function execute() { @@ -91,14 +86,7 @@ $this->graceSeconds = 1 * 60 * 60; } - $this->pruneLimit = intval( $this->getOption( 'limit', 25000 ) ); - - $until = $this->getCutoffTimestamp(); - $this->output( date( 'H:i:s' ) . " pruning entries older than " - . wfTimestamp( TS_ISO_8601, $until ) . "\n" ); - - $deleted = $this->pruneChanges( $until ); - $this->output( date( 'H:i:s' ) . " $deleted rows pruned.\n" ); + $this->doPrune(); $pidLock->removeLock(); // delete lockfile on normal exit } @@ -134,7 +122,7 @@ } /** - * Changes the cutoff timestamp to not affect more than $this->pruneLimit + * Changes the cutoff timestamp to not affect more than $this->mBatchSize * rows, if needed. * * @param int $until @@ -149,7 +137,7 @@ array( 'change_time < ' . $dbr->addQuotes( wfTimestamp( TS_MW, $until ) ) ), __METHOD__, array( - 'OFFSET' => $this->pruneLimit, + 'OFFSET' => $this->mBatchSize, 'ORDER BY' => 'change_time ASC', ) ); @@ -157,6 +145,24 @@ return $changeTime ? intval( $changeTime ) : $until; } + private function doPrune() { + while( true ) { + wfWaitForSlaves(); + + $until = $this->getCutoffTimestamp(); + + $this->output( date( 'H:i:s' ) . " pruning entries older than " + . wfTimestamp( TS_ISO_8601, $until ) . "\n" ); + + $affected = $this->pruneChanges( $until ); + $this->output( date( 'H:i:s' ) . " $affected rows pruned.\n" ); + + if ( $affected === 0 ) { + break; + } + } + } + /** * Prunes all changes older than $until from the changes table. * diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php index 3bfd0fe..60bbe4c 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/ApiErrorReporterTest.php @@ -109,7 +109,7 @@ '$expectedData' => array( 'fruit' => 'Banana', 'messages/0/name' => 'wikibase-api-no-such-sitelink', - 'messages/0/html/content' => '/gefunden/', // in German + 'messages/0/html' => '/gefunden/', // in German ), ), @@ -123,7 +123,7 @@ '$infoPattern' => '/^Malformed value\./', '$expectedData' => array( 'messages/0/name' => 'wikibase-parse-error', - 'messages/0/html/content' => '/Wert/', // in German + 'messages/0/html' => '/Wert/', // in German ), ), ); @@ -159,7 +159,7 @@ '$infoPattern' => '/sitelink/', '$expectedDataFields' => array( 'messages/0/name' => 'wikibase-api-no-such-sitelink', - 'messages/0/html/content' => '/gefunden/', // in German + 'messages/0/html' => '/gefunden/', // in German 'messages/0/parameters/0' => '/Foo/', ), ) @@ -201,10 +201,10 @@ '$infoPattern' => '/sitelink/', '$expectedData' => array( 'messages/0/name' => 'wikibase-api-no-such-sitelink', - 'messages/0/html/content' => '/gefunden/', // in German + 'messages/0/html' => '/gefunden/', // in German 'messages/1/name' => 'wikibase-noentity', 'messages/1/parameters/0' => 'Q123', - 'messages/1/html/content' => '/ist nicht vorhanden/', // in German + 'messages/1/html' => '/ist nicht vorhanden/', // in German ), ), @@ -297,9 +297,9 @@ '$status' => $status, '$expectedData' => array( 'warnings/main_int/messages/0/name' => 'wikibase-conflict-patched', - 'warnings/main_int/messages/0/html/content' => '/Version/', // in German + 'warnings/main_int/messages/0/html' => '/Version/', // in German 'warnings/main_int/messages/1/name' => 'undo-nochange', - 'warnings/main_int/messages/1/html/content' => '/Bearbeitung.*bereits/', // in German + 'warnings/main_int/messages/1/html' => '/Bearbeitung.*bereits/', // in German ), ), ); diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php index 94dd958..188a5cc 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php @@ -138,7 +138,12 @@ $module->execute(); $result = $module->getResult(); - return $result->getData(); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + return $data; } private function assertSuccess( $result ) { diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/EntityTestHelper.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/EntityTestHelper.php index 24dbff0..642bea2 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/EntityTestHelper.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/EntityTestHelper.php @@ -4,20 +4,6 @@ use DataValues\StringValue; use OutOfBoundsException; -use Wikibase\DataModel\Claim\Claim; -use Wikibase\DataModel\Entity\Entity; -use Wikibase\DataModel\Entity\EntityId; -use Wikibase\DataModel\Entity\Item; -use Wikibase\DataModel\Entity\ItemId; -use Wikibase\DataModel\Entity\Property; -use Wikibase\DataModel\Entity\PropertyId; -use Wikibase\DataModel\SiteLink; -use Wikibase\DataModel\Snak\PropertyValueSnak; -use Wikibase\DataModel\Term\AliasGroup; -use Wikibase\DataModel\Term\AliasGroupList; -use Wikibase\DataModel\Term\Fingerprint; -use Wikibase\DataModel\Term\Term; -use Wikibase\DataModel\Term\TermList; /** * @licence GNU GPL v2+ @@ -28,29 +14,21 @@ class EntityTestHelper { /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @var string[] List of currently active handles and their current ids */ private static $activeHandles = array(); /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @var string[] List of currently active ids and their current handles */ private static $activeIds; /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @var array[] Handles and any registered default output data */ private static $entityOutput = array(); /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @var array[] Set of pre defined entity data for use in tests */ private static $entityData = array( @@ -250,13 +228,6 @@ ); /** - * @var Entity[] filled by EntityTestHelper::fillTestEntities - */ - private static $testEntities = array(); - - /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Get the entity with the given handle * * @param string $handle String handle of entity to get data for @@ -278,8 +249,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Get the data to pass to the api to clear the entity with the given handle * * @param string $handle String handle of entity to get data for @@ -297,8 +266,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Get the data to pass to the api to create the entity with the given handle * * @param string $handle @@ -314,8 +281,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Get the data of the entity with the given handle we received after creation * * @param string $handle @@ -373,8 +338,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Register the entity after it has been created * * @param string $handle @@ -390,8 +353,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Unregister the entity after it has been cleared * * @param string $handle @@ -403,8 +364,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @return string[] List of currently active (registered) handles, using IDs as keys. */ public static function getActiveHandles() { @@ -412,8 +371,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @return string[] List of currently active (registered) IDs, using handles as keys. */ public static function getActiveIds() { @@ -421,8 +378,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Return the id for the entity with the given handle * * @param string $handle String handle of entity to get data for @@ -438,8 +393,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * @param $id string of entityid * @return null|string id of current handle (if active) */ @@ -473,233 +426,6 @@ } elseif ( is_string( $data ) ) { $data = str_replace( array_keys( $idMap ), array_values( $idMap ), $data ); } - } - - /** - * @since 0.5 - * - * @param EntityId|string $entityId - * - * @return null|Entity - */ - public static function getTestEntity( $entityId ) { - self::fillTestEntitiesIfEmpty(); - - if( $entityId instanceof EntityId ) { - $key = $entityId->getSerialization(); - } else { - $key = $entityId; - } - - if( array_key_exists( $key, self::$testEntities ) ) { - return self::$testEntities[ $key ]; - } else { - return null; - // FIXME? Should this throw an exception? - // throw new StorageException( 'Thrown by: ' . __CLASS__ . __METHOD__ ); - } - } - - /** - * Fills self::$testEntities with data (only if it is empty) - */ - private static function fillTestEntitiesIfEmpty() { - if( self::$testEntities === array() ) { - self::fillTestEntities(); - } - } - - /** - * Fills self::$testEntities with data - */ - private static function fillTestEntities() { - $entities = array(); - - $entities['Q1'] = new Item( new ItemId( 'Q1' ) ); - - $entities['Q2'] = new Item( new ItemId( 'Q2' ) ); - - $entities['P1'] = Property::newFromType( 'string' ); - $entities['P1']->setId( PropertyId::newFromNumber( 1 ) ); - - $entities['Q3'] = new Item( new ItemId( 'Q3' ) ); - $entities['Q3']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'Berlin' ), - new Term( 'en', 'Berlin' ), - new Term( 'nb', 'Berlin' ), - new Term( 'nn', 'Berlin' ), - ) - ), - new TermList( - array( - new Term( 'de', 'Bundeshauptstadt und Regierungssitz der Bundesrepublik Deutschland.' ), - new Term( 'en', 'Capital city and a federated state of the Federal Republic of Germany.' ), - new Term( 'nb', 'Hovedsted og delstat og i Forbundsrepublikken Tyskland.' ), - new Term( 'nn', 'Hovudstad og delstat i Forbundsrepublikken Tyskland.' ), - ) - ), - new AliasGroupList( - array( - new AliasGroup( 'de', array( 'Dickes B' ) ), - new AliasGroup( 'en', array( 'Dickes B' ) ), - new AliasGroup( 'nl', array( 'Dickes B' ) ), - ) - ) - ) - ); - $entities['Q3']->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Berlin' ); - $entities['Q3']->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Berlin' ); - $entities['Q3']->getSiteLinkList()->addNewSiteLink( 'nlwiki', 'Berlin' ); - $entities['Q3']->getSiteLinkList()->addNewSiteLink( 'nnwiki', 'Berlin' ); - $claim = new Claim ( - new PropertyValueSnak( - PropertyId::newFromNumber( 1 ), - new StringValue( 'imastring1' ) - ) - ); - $claim->setGuid( 'Q3$E9DC0EA4-D0A0-429B-8F4D-048F2B5C9F73' ); - $entities['Q3']->addClaim( $claim ); - - $entities['Q4'] = new Item( new ItemId( 'Q4' ) ); - $entities['Q4']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'London' ), - new Term( 'en', 'London' ), - new Term( 'nb', 'London' ), - new Term( 'nn', 'London' ), - ) - ), - new TermList( - array( - new Term( 'de', 'Hauptstadt Englands und des Vereinigten Königreiches.' ), - new Term( 'en', 'Capital city of England and the United Kingdom.' ), - new Term( 'nb', 'Hovedsted i England og Storbritannia.' ), - new Term( 'nn', 'Hovudstad i England og Storbritannia.' ), - ) - ), - new AliasGroupList( - array( - new AliasGroup( 'de', array( 'City of London', 'Greater London' ) ), - new AliasGroup( 'en', array( 'City of London', 'Greater London' ) ), - new AliasGroup( 'nl', array( 'City of London', 'Greater London' ) ), - ) - ) - ) - ); - $entities['Q4']->getSiteLinkList()->addNewSiteLink( 'dewiki', 'London' ); - $entities['Q4']->getSiteLinkList()->addNewSiteLink( 'enwiki', 'London' ); - $entities['Q4']->getSiteLinkList()->addNewSiteLink( 'nlwiki', 'London' ); - $entities['Q4']->getSiteLinkList()->addNewSiteLink( 'nnwiki', 'London' ); - - $entities['Q5'] = new Item( new ItemId( 'Q5' ) ); - $entities['Q5']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'Oslo' ), - new Term( 'en', 'Oslo' ), - new Term( 'nb', 'Oslo' ), - new Term( 'nn', 'Oslo' ), - ) - ), - new TermList( - array( - new Term( 'de', 'Hauptstadt der Norwegen.' ), - new Term( 'en', 'Capital city in Norway.' ), - new Term( 'nb', 'Hovedsted i Norge.' ), - new Term( 'nn', 'Hovudstad i Noreg.' ), - ) - ), - new AliasGroupList( - array( - new AliasGroup( 'nb', array( 'Christiania', 'Kristiania' ) ), - new AliasGroup( 'nn', array( 'Christiania', 'Kristiania' ) ), - new AliasGroup( 'de', array( 'Oslo City' ) ), - new AliasGroup( 'en', array( 'Oslo City' ) ), - new AliasGroup( 'nl', array( 'Oslo City' ) ), - ) - ) - ) - ); - $entities['Q5']->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Oslo' ); - $entities['Q5']->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Oslo' ); - $entities['Q5']->getSiteLinkList()->addNewSiteLink( 'nlwiki', 'Oslo' ); - $entities['Q5']->getSiteLinkList()->addNewSiteLink( 'nnwiki', 'Oslo' ); - - $entities['Q6'] = new Item( new ItemId( 'Q6' ) ); - $entities['Q6']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'Episkopi Cantonment' ), - new Term( 'en', 'Episkopi Cantonment' ), - new Term( 'nl', 'Episkopi Cantonment' ), - ) - ), - new TermList( - array( - new Term( 'de', 'Sitz der Verwaltung der Mittelmeerinsel Zypern.' ), - new Term( 'en', 'The capital of Akrotiri and Dhekelia.' ), - new Term( 'nl', 'Het bestuurlijke centrum van Akrotiri en Dhekelia.' ), - ) - ), - new AliasGroupList( - array( - new AliasGroup( 'de', array( 'Episkopi' ) ), - new AliasGroup( 'en', array( 'Episkopi' ) ), - new AliasGroup( 'nl', array( 'Episkopi' ) ), - ) - ) - ) - ); - $entities['Q6']->addSiteLink( new SiteLink( 'dewiki', 'Episkopi Cantonment' ) ); - $entities['Q6']->addSiteLink( new SiteLink( 'enwiki', 'Episkopi Cantonment' ) ); - $entities['Q6']->addSiteLink( new SiteLink( 'nlwiki', 'Episkopi Cantonment' ) ); - - $entities['Q7'] = new Item( new ItemId( 'Q7' ) ); - $entities['Q7']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'Leipzig' ), - ) - ), - new TermList( - array( - new Term( 'de', 'Stadt in Sachsen.' ), - new Term( 'en', 'City in Saxony.' ), - ) - ), - new AliasGroupList() - ) - ); - - $entities['Q8'] = new Item( new ItemId( 'Q8' ) ); - $entities['Q8']->setFingerprint( - new Fingerprint( - new TermList( - array( - new Term( 'de', 'Guangzhou' ), - new Term( 'yue', "廣州" ), - new Term( 'zh-cn', "广州市" ), - ) - ), - new TermList( - array( - new Term( 'en', 'Capital of Guangdong.' ), - new Term( 'zh-hk', "廣東的省會。" ), - ) - ), - new AliasGroupList() - ) - ); - - self::$testEntities = $entities; } } diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/FormatSnakValueTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/FormatSnakValueTest.php index ed1aeca..ad74d04 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/FormatSnakValueTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/FormatSnakValueTest.php @@ -4,12 +4,15 @@ use ApiTestCase; use DataValues\DataValue; +use DataValues\QuantityValue; use DataValues\StringValue; use DataValues\TimeValue; -use ValueFormatters\TimeFormatter; use Wikibase\DataModel\Entity\EntityIdValue; +use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; use Wikibase\Lib\SnakFormatter; +use Wikibase\Lib\Store\StorageException; +use Wikibase\Repo\WikibaseRepo; /** * @covers Wikibase\Api\FormatSnakValue @@ -25,12 +28,6 @@ * @author Daniel Kinzler */ class FormatSnakValueTest extends ApiTestCase { - - protected function setUp() { - parent::setUp(); - - $this->setMwGlobals( 'wgArticlePath', '/wiki/$1' ); - } public function provideApiRequest() { $november11 = new TimeValue( @@ -94,6 +91,13 @@ '@^http://acme\.test$@' ), array( + QuantityValue::newFromNumber( '+12.33', '1' ), + 'quantity', + SnakFormatter::FORMAT_PLAIN, + array( 'lang' => 'de' ), + '@^12,33$@' // german decimal separator + ), + array( new StringValue( 'http://acme.test' ), 'url', SnakFormatter::FORMAT_WIKI, @@ -108,21 +112,68 @@ '@commons\.wikimedia\.org\/wiki\/File:Example\.jpg@' ), array( - new EntityIdValue( new ItemId( 'Q2147483647' ) ), + new EntityIdValue( new ItemId( 'Q404' ) ), 'wikibase-item', SnakFormatter::FORMAT_HTML, null, - '/^Q2147483647' . $wordSeparator . '<span class="wb-entity-undefinedinfo">\(' . preg_quote( $deletedItem, '/' ) . '\)<\/span>$/' + '/^Q404' . $wordSeparator . '<span class="wb-entity-undefinedinfo">\(' . preg_quote( $deletedItem, '/' ) . '\)<\/span>$/' + ), + array( + new EntityIdValue( new ItemId( 'Q23' ) ), + 'wikibase-item', + SnakFormatter::FORMAT_HTML, + null, + '/^<a title="[^"]*Q23" href="[^"]+Q23">George Washington<\/a>$/' + ), + array( + new EntityIdValue( new ItemId( 'Q23' ) ), + 'wikibase-item', + SnakFormatter::FORMAT_HTML, + array( 'lang' => 'de-ch' ), // fallback + '/^<a title="[^"]*Q23" href="[^"]+Q23" lang="en">George Washington<\/a><sup class="wb-language-fallback-indicator">[^<>]+<\/sup>$/' ), // @TODO: Test an existing Item id ); } + private function setUpEntities() { + global $wgUser; + + static $setup = false; + + if ( $setup ) { + return; + } + + $setup = true; + + $store = WikibaseRepo::getDefaultInstance()->getStore()->getEntityStore(); + + // remove entities we care about + $idsToDelete = array( new ItemId( 'Q404' ), new ItemId( 'Q23' ) ); + foreach ( $idsToDelete as $id ) { + try { + $store->deleteEntity( $id, 'test', $wgUser ); + } catch ( StorageException $ex ) { + // ignore + } + } + + // set up Q23 + $item = new Item(); + $item->setId( new ItemId( 'Q23' ) ); + $item->getFingerprint()->setLabel( 'en', 'George Washington' ); + + $store->saveEntity( $item, 'testing', $wgUser, EDIT_NEW ); + } + /** * @dataProvider provideApiRequest */ public function testApiRequest( DataValue $value, $dataType, $format, $options, $pattern ) { + $this->setUpEntities(); + $params = array( 'action' => 'wbformatvalue', 'generate' => $format, diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/IndependentWikibaseApiTestCase.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/IndependentWikibaseApiTestCase.php index aecb8b5..d2c4e52 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/IndependentWikibaseApiTestCase.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/IndependentWikibaseApiTestCase.php @@ -53,7 +53,13 @@ public function doApiRequest( $params ) { $module = $this->getModule( $params ); $module->execute(); - return $module->getResultData(); + + $data = $module->getResult()->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + return $data; } /** diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/MergeItemsTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/MergeItemsTest.php index e6e2a0e..ff71ea3 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/MergeItemsTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/MergeItemsTest.php @@ -120,7 +120,12 @@ $module->execute(); $result = $module->getResult(); - return $result->getData(); + $data = $module->getResult()->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + return $data; } public function provideData() { diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/ParseValueTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/ParseValueTest.php index f5dbea5..aedfc4f 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/ParseValueTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/ParseValueTest.php @@ -84,7 +84,7 @@ '0/error-info' => '/^.+$/', '0/expected-format' => 'decimal', '0/messages/0/name' => 'wikibase-parse-error', - '0/messages/0/html/content' => '/^.+$/', + '0/messages/0/html' => '/^.+$/', ), ), @@ -97,7 +97,7 @@ '0/error-info' => '/^.+$/', '0/expected-format' => 'decimal', '0/messages/0/name' => 'wikibase-parse-error', - '0/messages/0/html/content' => '/^.+$/', + '0/messages/0/html' => '/^.+$/', ), ), diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php index 3a893a4..08d778a 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/ResultBuilderTest.php @@ -34,8 +34,7 @@ class ResultBuilderTest extends \PHPUnit_Framework_TestCase { protected function getDefaultResult( $indexedMode = false ){ - $apiMain = $this->getMockBuilder( 'ApiMain' )->disableOriginalConstructor()->getMockForAbstractClass(); - $result = new ApiResult( $apiMain ); + $result = new ApiResult( false ); if ( $indexedMode ) { $result->setRawMode(); @@ -121,7 +120,12 @@ $result = $this->getDefaultResult(); $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->markSuccess( $param ); - $this->assertEquals( array( 'success' => $expected ), $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( array( 'success' => $expected ), $data ); } public function provideMarkResultSuccess() { @@ -294,7 +298,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addEntityRevision( null, $entityRevision, new SerializationOptions(), $props ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddEntityRevisionKey() { @@ -309,13 +318,13 @@ // automatic key $resultBuilder->addEntityRevision( null, $entityRevision, new SerializationOptions(), $props ); - $data = $result->getData(); + $data = $result->getResultData(); $this->assertArrayHasKey( 'Q11', $data['entities'] ); // explicit key $resultBuilder->addEntityRevision( 'FOO', $entityRevision, new SerializationOptions(), $props ); - $data = $result->getData(); + $data = $result->getResultData(); $this->assertArrayHasKey( 'FOO', $data['entities'] ); } @@ -348,7 +357,12 @@ ), ) ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } /** @@ -401,7 +415,12 @@ '_element' => 'entity' ) ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => $indexedMode ? 'bc' : 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddBasicEntityInformation() { @@ -415,7 +434,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addBasicEntityInformation( $entityId, 'entity' ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddLabels(){ @@ -442,7 +466,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addLabels( $labels, $path ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddDescriptions(){ @@ -469,7 +498,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addDescriptions( $descriptions, $path ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddAliases(){ @@ -508,7 +542,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addAliases( $aliases, $path ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddSiteLinks(){ @@ -540,7 +579,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addSiteLinks( $siteLinks, $path ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddClaims(){ @@ -576,7 +620,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addClaims( $claims, $path ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddClaim(){ @@ -602,7 +651,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addClaim( $claim ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddReference(){ @@ -632,7 +686,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addReference( $reference ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } /** @@ -651,7 +710,12 @@ $resultBuilder->addMissingEntity( $key, $missingDetails ); } - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function provideMissingEntity() { @@ -736,7 +800,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addNormalizedTitle( $from, $to ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function testAddRevisionIdFromStatusToResult() { @@ -756,7 +825,12 @@ $resultBuilder = $this->getResultBuilder( $result ); $resultBuilder->addRevisionIdFromStatusToResult( $mockStatus, 'entity' ); - $this->assertEquals( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); + $this->assertEquals( $expected, $data ); } public function provideSetList() { @@ -804,7 +878,12 @@ $builder = $this->getResultBuilder( $result ); $builder->setList( $path, $name, $values, $tag ); - $this->assertResultStructure( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => $indexed ? 'bc' : 'all', + ) ); + $this->assertResultStructure( $expected, $data ); } public function provideSetList_InvalidArgument() { @@ -866,7 +945,12 @@ $builder = $this->getResultBuilder( $result ); $builder->setValue( $path, $name, $value ); - $this->assertResultStructure( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => $indexed ? 'bc' : 'all', + ) ); + $this->assertResultStructure( $expected, $data ); } public function provideSetValue_InvalidArgument() { @@ -946,7 +1030,12 @@ $builder = $this->getResultBuilder( $result ); $builder->appendValue( $path, $key, $value, $tag ); - $this->assertResultStructure( $expected, $result->getData() ); + $data = $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => $indexed ? 'bc' : 'all', + ) ); + $this->assertResultStructure( $expected, $data ); } public function provideAppendValue_InvalidArgument() { diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/SearchEntitiesTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/SearchEntitiesTest.php index 931fcbc..e19abcf 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/SearchEntitiesTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/SearchEntitiesTest.php @@ -228,7 +228,11 @@ $module->execute(); $result = $module->getResult(); - return $result->getData(); + return $result->getResultData( null, array( + 'BC' => array(), + 'Types' => array(), + 'Strip' => 'all', + ) ); } public function provideData() { diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/SetClaimTest.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/SetClaimTest.php index 74a05e0..0e79ee5 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/SetClaimTest.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/SetClaimTest.php @@ -8,7 +8,6 @@ use UsageException; use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\Claims; -use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\Entity\Property; @@ -163,7 +162,7 @@ } } - public function getInvalidCases() { + private function getInvalidCases() { $store = WikibaseRepo::getDefaultInstance()->getEntityStore(); $item = new Item(); @@ -231,6 +230,10 @@ $claim->setReferences( new ReferenceList( array( $reference ) ) ); $cases['mismatching value in reference'] = array( $q17, $claim, 'modification-failed' ); + $claim = new Statement( new Claim( $goodSnak ) ); + $claim->setGuid( 'XXXX' ); + $cases['invalid claim GUID'] = array( $qx, $claim, 'invalid-claim' ); + return $cases; } @@ -277,13 +280,13 @@ /** * @param Claim|array $claim Native or serialized claim object. * @param ItemId $itemId - * @param $claimCount - * @param $requestLabel string a label to identify requests that are made in errors + * @param int $claimCount + * @param string $requestLabel A label to identify requests that are made in errors. * @param int|null $index * @param int|null $baserevid * @param string $error */ - protected function makeRequest( + private function makeRequest( $claim, ItemId $itemId, $claimCount, @@ -294,7 +297,7 @@ ) { $serializerFactory = new SerializerFactory(); - if ( $claim instanceof Claim ) { + if ( $claim instanceof Statement ) { $serializer = $serializerFactory->newSerializerForObject( $claim ); $serializedClaim = $serializer->getSerialized( $claim ); } else { @@ -330,7 +333,7 @@ * * @return array|bool */ - protected function assertApiRequest( $params, $error ) { + private function assertApiRequest( $params, $error ) { $resultArray = false; try { @@ -350,7 +353,7 @@ return $resultArray; } - protected function assertValidResponse( array $resultArray ) { + private function assertValidResponse( array $resultArray ) { $this->assertResultSuccess( $resultArray ); $this->assertInternalType( 'array', $resultArray, 'top level element is an array' ); $this->assertArrayHasKey( 'pageinfo', $resultArray, 'top level element has a pageinfo key' ); @@ -363,17 +366,18 @@ /** * @param Claim $claim - * @param EntityId $entityId - * @param $claimCount - * @param $requestLabel string a label to identify requests that are made in errors + * @param ItemId $itemId + * @param int $claimCount + * @param string $requestLabel A label to identify requests that are made in errors. */ - protected function assertClaimWasSet( + private function assertClaimWasSet( Claim $claim, - EntityId $entityId, + ItemId $itemId, $claimCount, $requestLabel ) { - $item = WikibaseRepo::getDefaultInstance()->getEntityLookup()->getEntity( $entityId ); + /** @var Item $item */ + $item = WikibaseRepo::getDefaultInstance()->getEntityLookup()->getEntity( $itemId ); $claims = new Claims( $item->getClaims() ); $this->assertTrue( $claims->hasClaim( $claim ), "Claims list does not have claim after {$requestLabel}" ); @@ -383,7 +387,7 @@ $this->assertTrue( $claim->getQualifiers()->equals( $savedClaim->getQualifiers() ) ); } - $this->assertEquals( $claimCount, $claims->count(), "Claims count is wrong after {$requestLabel}" ); + $this->assertSame( $claimCount, $claims->count(), "Claims count is wrong after {$requestLabel}" ); } /** diff --git a/extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php b/extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php index 5987df7..a90102c 100644 --- a/extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php +++ b/extensions/Wikibase/repo/tests/phpunit/includes/api/WikibaseApiTestCase.php @@ -95,9 +95,6 @@ return $this->doApiRequest( $params, $session, false, $user ); } - /** - * @deprecated Please override the services in the API and use getTestEntity instead - */ protected function initTestEntities( array $handles, array $idMap = array() ) { $activeHandles = EntityTestHelper::getActiveHandles(); @@ -122,8 +119,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead - * * Loads an entity from the database (via an API call). */ protected function loadEntity( $id ) { @@ -138,7 +133,6 @@ } /** - * @deprecated Please override the services in the API and use getTestEntity instead * @see doTestQueryExceptions in IndependentWikibaseApiTestCase * * Do the test for exceptions from Api queries. diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 4685c63..17deb18 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1199,12 +1199,12 @@ "source": { "type": "git", "url": "https://github.com/wikimedia/mediawiki-extensions-Wikibase.git", - "reference": "f92b90659be189dc37baa16e46a0e3a3ea3b186c" + "reference": "891e7b3285cebc3154012228fdb117e87742fd8b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/f92b90659be189dc37baa16e46a0e3a3ea3b186c", - "reference": "f92b90659be189dc37baa16e46a0e3a3ea3b186c", + "url": "https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/891e7b3285cebc3154012228fdb117e87742fd8b", + "reference": "891e7b3285cebc3154012228fdb117e87742fd8b", "shasum": "" }, "require": { @@ -1231,7 +1231,7 @@ "conflict": { "mediawiki/mediawiki": "<1.23" }, - "time": "2015-04-16 21:25:02", + "time": "2015-04-18 01:24:08", "type": "mediawiki-extension", "installation-source": "dist", "autoload": { -- To view, visit https://gerrit.wikimedia.org/r/205003 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8dc3dfa8534e4206401ab01ee37b34f1dcf947f8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikidata Gerrit-Branch: master Gerrit-Owner: WikidataBuilder <wikidata-servi...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits