[MediaWiki-commits] [Gerrit] Do not call click on undefined - change (mediawiki/core)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174679

Change subject: Do not call click on undefined
..

Do not call click on undefined

Not all pages in a MediaWiki installation do have an edit link. For
example the pages in Wikidata do not have it.

Bug: 57713
Change-Id: I842c1224d15887d59eab73f2b222c232a05c0bd9
---
M resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/174679/1

diff --git 
a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js 
b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
index 3c22851..6ef5d32 100644
--- a/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
+++ b/resources/src/mediawiki.action/mediawiki.action.view.dblClickEdit.js
@@ -8,7 +8,8 @@
if ( parseInt( mw.user.options.get( 'editondblclick' ), 
10 ) ) {
e.preventDefault();
// Trigger native HTMLElement click instead of 
opening URL (bug 43052)
-   $( '#ca-edit a' ).get( 0 ).click();
+   var $a = $( '#ca-edit a' ).get( 0 );
+   $a  $a.click();
}
} );
} );

-- 
To view, visit https://gerrit.wikimedia.org/r/174679
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I842c1224d15887d59eab73f2b222c232a05c0bd9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix/update inline documentation of LoadBalancer - change (mediawiki/core)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174699

Change subject: Fix/update inline documentation of LoadBalancer
..

Fix/update inline documentation of LoadBalancer

Plus two very minor fixes in the code,
* an unused variable and
* a broken error message.

Change-Id: I40a39c81bd0d6d6054f983c82880f4bf31c21275
---
M includes/db/LoadBalancer.php
1 file changed, 15 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/99/174699/1

diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php
index 233c92f..19ef376 100644
--- a/includes/db/LoadBalancer.php
+++ b/includes/db/LoadBalancer.php
@@ -28,13 +28,13 @@
  * @ingroup Database
  */
 class LoadBalancer {
-   /** @var array Map of (server index = server config array) */
+   /** @var array[] Map of (server index = server config array) */
private $mServers;
-   /** @var array Map of (local/foreignUsed/foreignFree = server index = 
DatabaseBase array) */
+   /** @var array[] Map of (local/foreignUsed/foreignFree = server index 
= DatabaseBase array) */
private $mConns;
/** @var array Map of (server index = weight) */
private $mLoads;
-   /** @var array Map of (group = server index = weight) */
+   /** @var array[] Map of (group = server index = weight) */
private $mGroupLoads;
/** @var bool Whether to disregard slave lag as a factor in slave 
selection */
private $mAllowLagged;
@@ -197,8 +197,8 @@
 * always return a consistent index during a given invocation
 *
 * Side effect: opens connections to databases
-* @param bool|string $group
-* @param bool|string $wiki
+* @param string|bool $group Query group, or false for the generic 
reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
 * @throws MWException
 * @return bool|int|string
 */
@@ -218,7 +218,7 @@
return $this-mReadIndex;
}
 
-   $section = new ProfileSection( __METHOD__ );
+   new ProfileSection( __METHOD__ );
 
# Find the relevant load array
if ( $group !== false ) {
@@ -410,7 +410,7 @@
 
if ( $result == -1 || is_null( $result ) ) {
# Timed out waiting for slave, use master instead
-   $server = $this-mServers[$index];
+   $server = $this-mServers[$index]['host'];
$msg = __METHOD__ . : Timed out waiting on $server pos 
{$this-mWaitForPos};
wfDebug( $msg\n );
wfDebugLog( 'DBPerformance', $msg:\n . wfBacktrace( 
true ) );
@@ -432,8 +432,8 @@
 * This is the main entry point for this class.
 *
 * @param int $i Server index
-* @param array $groups Query groups
-* @param bool|string $wiki Wiki ID
+* @param array|string|bool $groups Query group(s), or false for the 
generic reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
 *
 * @throws MWException
 * @return DatabaseBase
@@ -556,8 +556,8 @@
 * @see LoadBalancer::getConnection() for parameter information
 *
 * @param int $db
-* @param mixed $groups
-* @param bool|string $wiki
+* @param array|string|bool $groups Query group(s), or false for the 
generic reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
 * @return DBConnRef
 */
public function getConnectionRef( $db, $groups = array(), $wiki = false 
) {
@@ -572,8 +572,8 @@
 * @see LoadBalancer::getConnection() for parameter information
 *
 * @param int $db
-* @param mixed $groups
-* @param bool|string $wiki
+* @param array|string|bool $groups Query group(s), or false for the 
generic reader
+* @param string|bool $wiki Wiki ID, or false for the current wiki
 * @return DBConnRef
 */
public function getLazyConnectionRef( $db, $groups = array(), $wiki = 
false ) {
@@ -589,7 +589,7 @@
 * error will be available via $this-mErrorConnection.
 *
 * @param int $i Server index
-* @param bool|string $wiki Wiki ID to open
+* @param string|bool $wiki Wiki ID, or false for the current wiki
 * @return DatabaseBase
 *
 * @access private
@@ -1119,7 +1119,7 @@
 * Results are cached for a short time in memcached/process cache
 *
 * @param string|bool $wiki
-* @return array Map of (server index = seconds)
+* @return int[] Map of (server index = seconds)
 */
function getLagTimes( $wiki = false

[MediaWiki-commits] [Gerrit] Phase out hasClaim and newClaim - change (mediawiki...Wikibase)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174775

Change subject: Phase out hasClaim and newClaim
..

Phase out hasClaim and newClaim

I focused on the deprecated methods hasClaim and newClaims in this
patch.

The idea is to make the strange patch
https://github.com/wmde/WikibaseDataModel/pull/280 smaller or at
least get rid of it faster.

Note that I still had to introduce more of these painful
new Statement( new Claim() ). There is no other way. If you see one
that does not make the test setup code explode, please show me.
Also see https://github.com/wmde/WikibaseDataModel/pull/268

Change-Id: I0777c53db88a90c34193545c439d5495fed4d6c6
---
M repo/includes/ChangeOp/ChangeOpMainSnak.php
M repo/includes/content/EntityContent.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
M repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php
M repo/tests/phpunit/includes/api/CreateClaimTest.php
M repo/tests/phpunit/includes/api/GetClaimsTest.php
M repo/tests/phpunit/includes/api/RemoveClaimsTest.php
M repo/tests/phpunit/includes/api/ResultBuilderTest.php
M repo/tests/phpunit/includes/api/SetClaimTest.php
M repo/tests/phpunit/includes/api/SetReferenceTest.php
10 files changed, 109 insertions(+), 98 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/75/174775/1

diff --git a/repo/includes/ChangeOp/ChangeOpMainSnak.php 
b/repo/includes/ChangeOp/ChangeOpMainSnak.php
index 9687a1a..28840cd 100644
--- a/repo/includes/ChangeOp/ChangeOpMainSnak.php
+++ b/repo/includes/ChangeOp/ChangeOpMainSnak.php
@@ -7,6 +7,7 @@
 use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Snak\Snak;
+use Wikibase\DataModel\StatementListProvider;
 use Wikibase\Lib\ClaimGuidGenerator;
 use Wikibase\Summary;
 use Wikibase\Validators\SnakValidator;
@@ -81,44 +82,45 @@
 * - the claim's mainsnak gets set to $snak when $claimGuid and $snak 
are set
 */
public function apply( Entity $entity, Summary $summary = null ) {
-   $claims = new Claims( $entity-getClaims() );
-
-   if ( is_null( $this-claimGuid ) || empty( $this-claimGuid ) ) 
{
-   $this-addClaim( $entity, $claims, $summary );
+   if ( empty( $this-claimGuid ) ) {
+   $this-addClaim( $entity, $summary );
} else {
+   $claims = new Claims( $entity-getClaims() );
$this-setClaim( $claims, $summary );
+   $entity-setClaims( $claims );
}
-
-   $entity-setClaims( $claims );
 
return true;
}
 
/**
-* @since 0.4
-*
 * @param Entity $entity
-* @param Claims $claims
-* @param Summary $summary
+* @param Summary|null $summary
+*
+* @throws ChangeOpException
 */
-   protected function addClaim( Entity $entity, Claims $claims, Summary 
$summary = null ) {
+   private function addClaim( Entity $entity, Summary $summary = null ) {
//TODO: check for claim uniqueness?
-   $claim = $entity-newClaim( $this-snak );
-   $claim-setGuid( $this-guidGenerator-newGuid( 
$entity-getId() ) );
-   $claims-addClaim( $claim );
+   $guid = $this-guidGenerator-newGuid( $entity-getId() );
+
+   if ( !( $entity instanceof StatementListProvider ) ) {
+   throw new ChangeOpException( '$entity must implement 
StatementListProvider' );
+   }
+
+   $entity-getStatements()-addNewStatement( $this-snak, null, 
null, $guid );
$this-updateSummary( $summary, 'create', '', 
$this-getClaimSummaryArgs( $this-snak ) );
-   $this-claimGuid = $claim-getGuid();
+   $this-claimGuid = $guid;
}
 
/**
 * @since 0.4
 *
 * @param Claims $claims
-* @param Summary $summary
+* @param Summary|null $summary
 *
 * @throws ChangeOpException
 */
-   protected function setClaim( Claims $claims, Summary $summary = null ) {
+   private function setClaim( Claims $claims, Summary $summary = null ) {
if( !$claims-hasClaimWithGuid( $this-claimGuid ) ) {
throw new ChangeOpException( Entity does not have 
claim with GUID  . $this-claimGuid );
}
@@ -163,4 +165,5 @@
public function validate( Entity $entity ) {
return $this-snakValidator-validate( $this-snak );
}
+
 }
diff --git a/repo/includes/content/EntityContent.php 
b/repo/includes/content/EntityContent.php
index 58a8767..f1d5109 100644
--- a/repo/includes/content/EntityContent.php
+++ b/repo/includes/content/EntityContent.php
@@ -10,13

[MediaWiki-commits] [Gerrit] Rework and drop unused code from EditEntityAction - change (mediawiki...Wikibase)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174836

Change subject: Rework and drop unused code from EditEntityAction
..

Rework and drop unused code from EditEntityAction

Change-Id: Iea535aeb6be88311ff66eca149967f11fde1be35
---
M repo/includes/actions/EditEntityAction.php
1 file changed, 81 insertions(+), 116 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/36/174836/1

diff --git a/repo/includes/actions/EditEntityAction.php 
b/repo/includes/actions/EditEntityAction.php
index 479a07b..c613acc 100644
--- a/repo/includes/actions/EditEntityAction.php
+++ b/repo/includes/actions/EditEntityAction.php
@@ -39,57 +39,50 @@
 abstract class EditEntityAction extends ViewEntityAction {
 
/**
-* @var EntityIdLabelFormatter
-*/
-   protected $propertyNameFormatter;
-
-   /**
-* @var SnakFormatter
-*/
-   protected $detailedSnakFormatter;
-
-   /**
-* @var SnakFormatter
-*/
-   protected $terseSnakFormatter;
-
-   /**
 * @var EntityDiffVisualizer
 */
-   protected $diffVisualizer;
+   private $entityDiffVisualizer;
 
+   /**
+* @param Page $page
+* @param IContextSource|null $context
+*/
public function __construct( Page $page, IContextSource $context = null 
) {
parent::__construct( $page, $context );
 
-   $langCode = $this-getContext()-getLanguage()-getCode();
+   $languageCode = $this-getContext()-getLanguage()-getCode();
 
//TODO: proper injection
$options = new FormatterOptions( array(
//TODO: fallback chain
-   ValueFormatter::OPT_LANG = $langCode
+   ValueFormatter::OPT_LANG = $languageCode
) );
 
$wikibaseRepo = WikibaseRepo::getDefaultInstance();
 
$termLookup = new EntityRetrievingTermLookup( 
$wikibaseRepo-getEntityLookup() );
-   $labelLookup = new LanguageLabelLookup( $termLookup, $langCode 
);
+   $labelLookup = new LanguageLabelLookup( $termLookup, 
$languageCode );
$labelFormatter = new EntityIdLabelFormatter( $options, 
$labelLookup );
 
-   $this-propertyNameFormatter = new EscapingValueFormatter( 
$labelFormatter, 'htmlspecialchars' );
+   $propertyIdFormatter = new EscapingValueFormatter( 
$labelFormatter, 'htmlspecialchars' );
 
$formatterFactory = $wikibaseRepo-getSnakFormatterFactory();
-   $this-detailedSnakFormatter = 
$formatterFactory-getSnakFormatter( SnakFormatter::FORMAT_HTML_DIFF, $options 
);
-   $this-terseSnakFormatter = 
$formatterFactory-getSnakFormatter( SnakFormatter::FORMAT_HTML, $options );
+   $snakDetailsFormatter = $formatterFactory-getSnakFormatter( 
SnakFormatter::FORMAT_HTML_DIFF, $options );
+   $snakBreadCrumbFormatter = $formatterFactory-getSnakFormatter( 
SnakFormatter::FORMAT_HTML, $options );
 
-   $this-diffVisualizer = new EntityDiffVisualizer(
+   $this-entityDiffVisualizer = new EntityDiffVisualizer(
$this-getContext(),
new ClaimDiffer( new OrderedListDiffer( new 
ComparableComparer() ) ),
-   new ClaimDifferenceVisualizer( 
$this-propertyNameFormatter, $this-detailedSnakFormatter, 
$this-terseSnakFormatter, $langCode ),
+   new ClaimDifferenceVisualizer(
+   $propertyIdFormatter,
+   $snakDetailsFormatter,
+   $snakBreadCrumbFormatter,
+   $languageCode
+   ),
$wikibaseRepo-getSiteStore(),
$wikibaseRepo-getEntityTitleLookup(),
$wikibaseRepo-getEntityRevisionLookup()
);
-
}
 
/**
@@ -108,13 +101,12 @@
 *
 * @since 0.1
 *
-* @param String $action the action to check
+* @param string $action The action to check
 *
 * @return bool true if there were permission errors
 */
-   public function showPermissionError( $action ) {
+   protected function showPermissionError( $action ) {
if ( !$this-getTitle()-userCan( $action, $this-getUser() ) ) 
{
-
$this-getOutput()-showPermissionsErrorPage(
array( 
$this-getTitle()-getUserPermissionsErrors( $action, $this-getUser() ) ),
$action
@@ -135,7 +127,7 @@
 * @return Status a Status object containing an array with three 
revisions, ($olderRevision, $newerRevision, $latestRevision

[MediaWiki-commits] [Gerrit] Remove unused use clauses and fix typo in a class name - change (mediawiki...Wikibase)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174842

Change subject: Remove unused use clauses and fix typo in a class name
..

Remove unused use clauses and fix typo in a class name

Change-Id: I72a07642123864c6e54203372e520c9805b39bbd
---
M client/WikibaseClient.hooks.php
M client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
M client/includes/WikibaseClient.php
M client/includes/scribunto/WikibaseLuaEntityBindings.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
M client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
M lib/tests/phpunit/TimeFormatterParserRoundtripTest.php
M lib/tests/phpunit/WikibaseDataTypeBuildersTest.php
M lib/tests/phpunit/serializers/EntitySerializerBaseTest.php
12 files changed, 11 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/42/174842/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 508d905..9858fbb 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -5,9 +5,11 @@
 use Action;
 use BaseTemplate;
 use ChangesList;
+use Content;
 use FormOptions;
 use IContextSource;
 use JobQueueGroup;
+use ManualLogEntry;
 use Message;
 use MovePageForm;
 use MWException;
@@ -25,25 +27,23 @@
 use UnexpectedValueException;
 use User;
 use Wikibase\Client\Changes\ChangeHandler;
-use WikiPage;
-use Content;
-use ManualLogEntry;
+use Wikibase\Client\DeletePageNoticeCreator;
 use Wikibase\Client\Hooks\BaseTemplateAfterPortletHandler;
 use Wikibase\Client\Hooks\BeforePageDisplayHandler;
 use Wikibase\Client\Hooks\ChangesPageWikibaseFilterHandler;
 use Wikibase\Client\Hooks\InfoActionHookHandler;
 use Wikibase\Client\Hooks\SpecialWatchlistQueryHandler;
 use Wikibase\Client\MovePageNotice;
-use Wikibase\Client\DeletePageNoticeCreator;
 use Wikibase\Client\RecentChanges\ChangeLineFormatter;
 use Wikibase\Client\RecentChanges\ExternalChangeFactory;
 use Wikibase\Client\RecentChanges\RecentChangesFilterOptions;
 use Wikibase\Client\RepoItemLinkGenerator;
-use Wikibase\Client\UpdateRepo\UpdateRepoOnMove;
 use Wikibase\Client\UpdateRepo\UpdateRepoOnDelete;
+use Wikibase\Client\UpdateRepo\UpdateRepoOnMove;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\SiteLink;
+use WikiPage;
 
 /**
  * File defining the hook handlers for the Wikibase Client extension.
diff --git a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php 
b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
index e4451d7..d85204b 100644
--- a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
+++ b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
@@ -8,7 +8,6 @@
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\BestStatementsFinder;
 use Wikibase\DataModel\Statement\Statement;
-use Wikibase\DataModel\Statement\StatementList;
 use Wikibase\DataModel\StatementListProvider;
 use Wikibase\Lib\Store\EntityLookup;
 
diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index a9b29a5..7c3ebd1 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -13,7 +13,6 @@
 use Site;
 use SiteSQLStore;
 use SiteStore;
-use ValueFormatters\FormatterOptions;
 use Wikibase\Client\Changes\AffectedPagesFinder;
 use Wikibase\Client\Changes\ChangeHandler;
 use Wikibase\Client\Changes\ChangeRunCoalescer;
diff --git a/client/includes/scribunto/WikibaseLuaEntityBindings.php 
b/client/includes/scribunto/WikibaseLuaEntityBindings.php
index f1fdd77..f90ca80 100644
--- a/client/includes/scribunto/WikibaseLuaEntityBindings.php
+++ b/client/includes/scribunto/WikibaseLuaEntityBindings.php
@@ -7,14 +7,14 @@
 use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\EntityIdValue;
-use Wikibase\DataModel\StatementListProvider;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
 use Wikibase\DataModel\Snak\Snak;
+use Wikibase\DataModel\StatementListProvider;
 use Wikibase\Lib\SnakFormatter;
 use Wikibase\Lib\Store\EntityLookup;
-use Wikibase\DataModel\Entity\EntityIdParser;
 
 /**
  * Actual implementations of the functions to access Wikibase through the 
Scribunto extension
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index 814d8b6..57b5d06 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b

[MediaWiki-commits] [Gerrit] Small clean ups in Changes related code - change (mediawiki...Wikibase)

2014-11-20 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174848

Change subject: Small clean ups in Changes related code
..

Small clean ups in Changes related code

This are some small bits split from If6c96e0. I still don't know
what causes the error there.

Change-Id: Ic4950314d320105e36abc2eb7678f01451288ba7
---
M client/includes/Changes/ChangeHandler.php
M client/includes/Changes/ChangeListTransformer.php
M client/includes/Changes/ChangeRunCoalescer.php
M client/includes/Changes/PageUpdater.php
M client/includes/Changes/WikiPageUpdater.php
M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
M client/tests/phpunit/includes/Changes/MockPageUpdater.php
7 files changed, 25 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/48/174848/1

diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index 0d6ddbd..037dfcd 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -137,7 +137,6 @@
 * @param Change $change
 *
 * @throws MWException
-*
 * @return bool
 */
public function handleChange( Change $change ) {
@@ -262,7 +261,7 @@
 *
 * @since 0.4
 *
-* @param \Wikibase\EntityChange $change The Change that caused the 
update
+* @param EntityChange $change The Change that caused the update
 *
 * @return array|boolean an array of RC attributes,
 * or false if the change does not provide edit meta data
@@ -354,7 +353,7 @@
 *
 * @param EntityChange $change the change to get a comment for
 *
-* @throws \MWException
+* @throws MWException
 * @return array
 */
public function getEditComment( EntityChange $change ) {
@@ -369,7 +368,7 @@
 
$editComment = $commentCreator-getEditComment( $siteLinkDiff, 
$action, $comment );
if( is_array( $editComment )  !isset( $editComment['message'] 
) ) {
-   throw new \MWException( 'getEditComment returned an 
empty comment' );
+   throw new MWException( 'getEditComment returned an 
empty comment' );
}
 
return $editComment;
diff --git a/client/includes/Changes/ChangeListTransformer.php 
b/client/includes/Changes/ChangeListTransformer.php
index 1552a74..65d8a0a 100644
--- a/client/includes/Changes/ChangeListTransformer.php
+++ b/client/includes/Changes/ChangeListTransformer.php
@@ -11,7 +11,6 @@
  *
  * @licence GNU GPL v2+
  * @author Daniel Kinzler
- *
  */
 interface ChangeListTransformer {
 
diff --git a/client/includes/Changes/ChangeRunCoalescer.php 
b/client/includes/Changes/ChangeRunCoalescer.php
index d81c56a..76974e3 100644
--- a/client/includes/Changes/ChangeRunCoalescer.php
+++ b/client/includes/Changes/ChangeRunCoalescer.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Client\Changes;
 
+use Exception;
 use MWException;
 use Wikibase\Change;
 use Wikibase\EntityChange;
@@ -19,7 +20,6 @@
  *
  * @licence GNU GPL v2+
  * @author Daniel Kinzler
- *
  */
 class ChangeRunCoalescer implements ChangeListTransformer {
 
@@ -71,20 +71,20 @@
$coalesced = array_merge( $coalesced, $entityChanges );
}
 
-   usort( $coalesced, 
'Wikibase\Client\Changes\ChangeRunCoalescer::compareChangesByTimestamp' );
+   usort( $coalesced, array( $this, 'compareChangesByTimestamp' ) 
);
 
-   wfDebugLog( __CLASS__, __METHOD__ . : coalesced 
-   . count( $changes ) .  into  . count( $coalesced ) . 
 changes  );
+   wfDebugLog( __CLASS__, __METHOD__ . ': coalesced '
+   . count( $changes ) . ' into ' . count( $coalesced ) . 
' changes' );
 
wfProfileOut( __METHOD__ );
return $coalesced;
}
 
-
/**
 * Group changes by the entity they were applied to.
 *
 * @param EntityChange[] $changes
+*
 * @return EntityChange[][] an associative array using entity IDs for 
keys. Associated with each
 * entity ID is the list of changes performed on that entity.
 */
@@ -211,6 +211,7 @@
 * Interleaved changes to different items will break runs.
 *
 * @param EntityChange[] $changes
+*
 * @return EntityChange[] grouped changes
 */
private function coalesceRuns( array $changes ) {
@@ -270,8 +271,8 @@
 
$currentRun[] = $change;
// skip any change that failed to process in 
some way (bug 49417)
-   } catch ( \Exception $e ) {
-   wfLogWarning( __METHOD__

[MediaWiki-commits] [Gerrit] Fix call on undefined in entityselector.js - change (mediawiki...Wikibase)

2014-11-25 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175761

Change subject: Fix call on undefined in entityselector.js
..

Fix call on undefined in entityselector.js

The .label property is not necesarrily set. Calling .toLowerCase()
on undefined causes this to fail. The error is not horrible, as far
as I can see, so this does not need to be backported.

Change-Id: Ic47db34e6e94ce85949795a19655b371041862c2
---
M lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/61/175761/1

diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
index 1b17f4c..fcf27d6 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
@@ -179,14 +179,14 @@
this.__searching = setTimeout( function() {
self.search( event )
.done( function( suggestions, requestTerm ) {
-   if( suggestions.length === 0 || 
self.element.val() !== requestTerm ) {
+   if( !suggestions.length || 
self.element.val() !== requestTerm ) {
return;
}
+   var label = suggestions[0].label || 
suggestions[0].id;
 
-   if(
-   suggestions[0].label === 
requestTerm
+   if( label === requestTerm
|| !self.options.caseSensitive
-
suggestions[0].label.toLowerCase() === requestTerm.toLowerCase()
+label.toLowerCase() 
=== requestTerm.toLowerCase()
) {
self._select( suggestions[0] );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/175761
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic47db34e6e94ce85949795a19655b371041862c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Narrow TermSqlIndex interface to EntityId - change (mediawiki...Wikibase)

2014-11-25 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175803

Change subject: Narrow TermSqlIndex interface to EntityId
..

Narrow TermSqlIndex interface to EntityId

Change-Id: I179e1f4f6794819c7497dc8b33579ea0720c10b8
---
M lib/includes/store/sql/TermSqlIndex.php
1 file changed, 21 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/03/175803/1

diff --git a/lib/includes/store/sql/TermSqlIndex.php 
b/lib/includes/store/sql/TermSqlIndex.php
index 1ec6880..4b5a54a 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -105,7 +105,7 @@
$termsToDelete = array_udiff( $oldTerms, $newTerms, 
'Wikibase\Term::compare' );
 
if ( !$termsToInsert  !$termsToDelete ) {
-   wfDebugLog( __CLASS__, __FUNCTION__ . : terms did not 
change, returning. );
+   wfDebugLog( __CLASS__, __FUNCTION__ . ': terms did not 
change, returning.' );
wfProfileOut( __METHOD__ );
return true;
}
@@ -114,18 +114,13 @@
$dbw = $this-getConnection( DB_MASTER );
 
if ( $ok  $termsToDelete ) {
-   wfDebugLog( __CLASS__, __FUNCTION__ . :  . count( 
$termsToDelete ) .  terms to delete. );
-   $ok = $dbw-deadlockLoop( array( $this, 
'deleteTermsInternal' ), $entity, $termsToDelete, $dbw );
+   wfDebugLog( __CLASS__, __FUNCTION__ . ': ' . count( 
$termsToDelete ) . ' terms to delete.' );
+   $ok = $dbw-deadlockLoop( array( $this, 
'deleteTermsInternal' ), $entity-getId(), $termsToDelete, $dbw );
}
 
if ( $ok  $termsToInsert ) {
-   wfDebugLog( __CLASS__, __FUNCTION__ . :  . count( 
$termsToInsert ) .  terms to insert. );
-
-   // TODO: remove silly self hack when we can use PHP 5.4
-   $self = $this;
-   $ok = $dbw-deadlockLoop( function() use ( $self, 
$entity, $termsToInsert, $dbw ) {
-   return $self-insertTermsInternal( $entity, 
$termsToInsert, $dbw );
-   } );
+   wfDebugLog( __CLASS__, __FUNCTION__ . ': ' . count( 
$termsToInsert ) . ' terms to insert.' );
+   $ok = $dbw-deadlockLoop( array( $this, 
'insertTermsInternal' ), $entity, $termsToInsert, $dbw );
}
 
$this-releaseConnection( $dbw );
@@ -250,26 +245,26 @@
 *
 * @since 0.5
 *
-* @param EntityDocument $entity
+* @param EntityId $entityId
 * @param Term[] $terms
 * @param DatabaseBase $dbw
 *
 * @return boolean Success indicator
 */
-   public function deleteTermsInternal( EntityDocument $entity, $terms, 
DatabaseBase $dbw ) {
+   public function deleteTermsInternal( EntityId $entityId, $terms, 
DatabaseBase $dbw ) {
wfProfileIn( __METHOD__ );
 
//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.
 
$entityIdentifiers = array(
-   'term_entity_id' = $entity-getId()-getNumericId(),
-   'term_entity_type' = $entity-getId()-getEntityType()
+   'term_entity_id' = $entityId-getNumericId(),
+   'term_entity_type' = $entityId-getEntityType()
);
 
$uniqueKeyFields = array( 'term_entity_type', 'term_entity_id', 
'term_language', 'term_type', 'term_text' );
 
-   wfDebugLog( __CLASS__, __FUNCTION__ . ': deleting terms for ' . 
$entity-getId()-getSerialization() );
+   wfDebugLog( __CLASS__, __FUNCTION__ . ': deleting terms for ' . 
$entityId-getSerialization() );
 
$success = true;
foreach ( $terms as $term ) {
@@ -378,16 +373,16 @@
 * Returns the terms stored for the given entity.
 * @see TermIndex::getTermsOfEntity
 *
-* @param EntityId $id
+* @param EntityId $entityId
 *
 * @return Term[]
 */
-   public function getTermsOfEntity( EntityId $id ) {
+   public function getTermsOfEntity( EntityId $entityId ) {
wfProfileIn( __METHOD__ );
 
$entityIdentifiers = array(
-   'term_entity_id' = $id-getNumericId(),
-   'term_entity_type' = $id-getEntityType()
+   'term_entity_id' = $entityId-getNumericId(),
+   'term_entity_type' = $entityId-getEntityType()
);
 
$fields

[MediaWiki-commits] [Gerrit] Make stuff in CachingEntityRevisionLookup private - change (mediawiki...Wikibase)

2014-11-25 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175823

Change subject: Make stuff in CachingEntityRevisionLookup private
..

Make stuff in CachingEntityRevisionLookup private

Change-Id: I4aa42518308c641b2d90c775c0c5c39afbdd01cb
---
M lib/includes/store/CachingEntityRevisionLookup.php
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/23/175823/1

diff --git a/lib/includes/store/CachingEntityRevisionLookup.php 
b/lib/includes/store/CachingEntityRevisionLookup.php
index cc512bf..968e403 100644
--- a/lib/includes/store/CachingEntityRevisionLookup.php
+++ b/lib/includes/store/CachingEntityRevisionLookup.php
@@ -19,31 +19,31 @@
/**
 * @var EntityRevisionLookup
 */
-   protected $lookup;
+   private $lookup;
 
/**
 * The cache to use for caching entities.
 *
 * @var BagOStuff
 */
-   protected $cache;
+   private $cache;
 
/**
 * @var int $cacheTimeout
 */
-   protected $cacheTimeout;
+   private $cacheTimeout;
 
/**
 * The key prefix to use when caching entities in memory.
 *
 * @var $cacheKeyPrefix
 */
-   protected $cacheKeyPrefix;
+   private $cacheKeyPrefix;
 
/**
 * @var bool $shouldVerifyRevision
 */
-   protected $shouldVerifyRevision;
+   private $shouldVerifyRevision;
 
/**
 * @param EntityRevisionLookup $entityRevisionLookup The lookup to use
@@ -81,7 +81,7 @@
 *
 * @return String
 */
-   protected function getCacheKey( EntityId $entityId ) {
+   private function getCacheKey( EntityId $entityId ) {
$cacheKey = $this-cacheKeyPrefix . ':' . 
$entityId-getSerialization();
 
return $cacheKey;

-- 
To view, visit https://gerrit.wikimedia.org/r/175823
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4aa42518308c641b2d90c775c0c5c39afbdd01cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Rework and clean up MockRepository and related - change (mediawiki...Wikibase)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175968

Change subject: Rework and clean up MockRepository and related
..

Rework and clean up MockRepository and related

Change-Id: Ieac330e5c1a6c99af27cc288f602cac6456ea079
---
M lib/includes/store/EntityInfoBuilderFactory.php
M lib/includes/store/SiteLinkLookup.php
M lib/includes/store/sql/SiteLinkTable.php
M lib/includes/store/sql/SqlEntityInfoBuilderFactory.php
M lib/tests/phpunit/MockRepository.php
5 files changed, 202 insertions(+), 229 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/68/175968/1

diff --git a/lib/includes/store/EntityInfoBuilderFactory.php 
b/lib/includes/store/EntityInfoBuilderFactory.php
index 56b41b5..6ce254c 100644
--- a/lib/includes/store/EntityInfoBuilderFactory.php
+++ b/lib/includes/store/EntityInfoBuilderFactory.php
@@ -20,9 +20,10 @@
 * Returns a new EntityInfoBuilder for gathering information about the
 * Entities specified by the given IDs.
 *
-* @param EntityId[] $ids
+* @param EntityId[] $entityIds
 *
 * @return EntityInfoBuilder
 */
-   public function newEntityInfoBuilder( array $ids );
+   public function newEntityInfoBuilder( array $entityIds );
+
 }
diff --git a/lib/includes/store/SiteLinkLookup.php 
b/lib/includes/store/SiteLinkLookup.php
index 9af6623..5a79e38 100644
--- a/lib/includes/store/SiteLinkLookup.php
+++ b/lib/includes/store/SiteLinkLookup.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Lib\Store;
 
+use DatabaseBase;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
@@ -21,14 +22,14 @@
 * currently in the store. The array is empty if there are no such 
conflicts.
 *
 * The items in the return array are arrays with the following elements:
-* - integer itemId
+* - int itemId
 * - string siteId
 * - string sitePage
 *
 * @since 0.1
 *
 * @param Item  $item
-* @param \DatabaseBase|null $db The database object to use (optional).
+* @param DatabaseBase|null $db The database object to use (optional).
 *If conflict checking is performed as part of a save operation,
 *this should be used to provide the master DB connection that 
will
 *also be used for saving. This will preserve transactional 
integrity
@@ -36,7 +37,7 @@
 *
 * @return array of array
 */
-   public function getConflictsForItem( Item $item, \DatabaseBase $db = 
null );
+   public function getConflictsForItem( Item $item, DatabaseBase $db = 
null );
 
/**
 * Returns the id of the item that is equivalent to the
@@ -59,11 +60,11 @@
 *
 * @since 0.3
 *
-* @param array $itemIds
-* @param array $siteIds
-* @param array $pageNames
+* @param int[] $itemIds
+* @param string[] $siteIds
+* @param string[] $pageNames
 *
-* @return integer
+* @return int
 */
public function countLinks( array $itemIds, array $siteIds = array(), 
array $pageNames = array() );
 
@@ -79,9 +80,9 @@
 *
 * @since 0.3
 *
-* @param array $itemIds
-* @param array $siteIds
-* @param array $pageNames
+* @param int[] $itemIds
+* @param string[] $siteIds
+* @param string[] $pageNames
 *
 * @return array[]
 */
diff --git a/lib/includes/store/sql/SiteLinkTable.php 
b/lib/includes/store/sql/SiteLinkTable.php
index 06eb099..f9afb6e 100644
--- a/lib/includes/store/sql/SiteLinkTable.php
+++ b/lib/includes/store/sql/SiteLinkTable.php
@@ -383,13 +383,11 @@
/**
 * @see SiteLinkLookup::countLinks
 *
-* @since 0.3
+* @param int[] $itemIds
+* @param string[] $siteIds
+* @param string[] $pageNames
 *
-* @param array $itemIds
-* @param array $siteIds
-* @param array $pageNames
-*
-* @return integer
+* @return int
 */
public function countLinks( array $itemIds, array $siteIds = array(), 
array $pageNames = array() ) {
$dbr = $this-getConnection( DB_SLAVE );
@@ -422,15 +420,12 @@
/**
 * @see SiteLinkLookup::getLinks
 *
-* @note: SiteLink objects returned from this method will not contain 
badges!
-*
-* @since 0.3
-*
-* @param array $itemIds
-* @param array $siteIds
-* @param array $pageNames
+* @param int[] $itemIds
+* @param string[] $siteIds
+* @param string[] $pageNames
 *
 * @return array[]
+* @note The arrays returned by this method do

[MediaWiki-commits] [Gerrit] Drop unused code from EntityViewTest - change (mediawiki...Wikibase)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175973

Change subject: Drop unused code from EntityViewTest
..

Drop unused code from EntityViewTest

If all tests succeed this can not be wrong, right?

This is split from I04767f2 to make it easier to review.

Change-Id: I4a30f59d62b662e1a32db865acacf401ec619300
---
M repo/tests/phpunit/includes/EntityViewTest.php
1 file changed, 0 insertions(+), 230 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/73/175973/1

diff --git a/repo/tests/phpunit/includes/EntityViewTest.php 
b/repo/tests/phpunit/includes/EntityViewTest.php
index 65917c9..fa4d544 100644
--- a/repo/tests/phpunit/includes/EntityViewTest.php
+++ b/repo/tests/phpunit/includes/EntityViewTest.php
@@ -2,35 +2,14 @@
 
 namespace Wikibase\Test;
 
-use IContextSource;
-use InvalidArgumentException;
-use Language;
-use RequestContext;
-use Title;
 use ValueFormatters\FormatterOptions;
-use Wikibase\DataModel\Claim\Claim;
-use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Entity\EntityIdValue;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Entity\Property;
 use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Snak\PropertyValueSnak;
-use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\Statement;
-use Wikibase\EntityRevision;
-use Wikibase\EntityView;
-use Wikibase\LanguageFallbackChain;
-use Wikibase\Lib\Serializers\SerializationOptions;
-use Wikibase\Lib\SnakFormatter;
-use Wikibase\Lib\Store\EntityInfoBuilderFactory;
-use Wikibase\Lib\Store\EntityTitleLookup;
-use Wikibase\ParserOutputJsConfigBuilder;
-use Wikibase\ReferencedEntitiesFinder;
-use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Utils;
 
 /**
  * @covers Wikibase\EntityView
@@ -47,161 +26,6 @@
  * @author Daniel Kinzler
  */
 abstract class EntityViewTest extends \MediaWikiLangTestCase {
-
-   /**
-* @var MockRepository
-*/
-   private $mockRepository;
-
-   protected function newEntityIdParser() {
-   // The data provides use P123 and Q123 IDs, so the parser needs 
to understand these.
-   return new BasicEntityIdParser();
-   }
-
-   public function getTitleForId( EntityId $id ) {
-   $name = $id-getEntityType() . ':' . $id-getSerialization();
-   return Title::makeTitle( NS_MAIN, $name );
-   }
-
-   /**
-* @return EntityTitleLookup
-*/
-   protected function getEntityTitleLookupMock() {
-   $lookup = $this-getMock( 
'Wikibase\Lib\Store\EntityTitleLookup' );
-   $lookup-expects( $this-any() )
-   -method( 'getTitleForId' )
-   -will( $this-returnCallback( array( $this, 
'getTitleForId' ) ) );
-
-   return $lookup;
-   }
-
-   /**
-* @return SnakFormatter
-*/
-   protected function newSnakFormatterMock() {
-   $snakFormatter = $this-getMock( 'Wikibase\Lib\SnakFormatter' );
-
-   $snakFormatter-expects( $this-any() )-method( 'formatSnak' )
-   -will( $this-returnValue( '(value)' ) );
-
-   $snakFormatter-expects( $this-any() )-method( 'getFormat' )
-   -will( $this-returnValue( 
SnakFormatter::FORMAT_HTML_WIDGET ) );
-
-   $snakFormatter-expects( $this-any() )-method( 
'canFormatSnak' )
-   -will( $this-returnValue( true ) );
-
-   return $snakFormatter;
-   }
-
-   /**
-* @param string $entityType
-* @param EntityInfoBuilderFactory $entityInfoBuilderFactory
-* @param EntityTitleLookup $entityTitleLookup
-* @param IContextSource $context
-* @param LanguageFallbackChain $languageFallbackChain
-*
-* @throws InvalidArgumentException
-* @return EntityView
-*/
-   protected function newEntityView(
-   $entityType,
-   EntityInfoBuilderFactory $entityInfoBuilderFactory = null,
-   EntityTitleLookup $entityTitleLookup = null,
-   IContextSource $context = null,
-   LanguageFallbackChain $languageFallbackChain = null
-   ) {
-   if ( !is_string( $entityType ) ) {
-   throw new InvalidArgumentException( '$entityType must 
be a string!' );
-   }
-
-   $langCode = 'en';
-
-   if ( $context === null ) {
-   $context = new RequestContext();
-   $context-setLanguage( $langCode );
-   }
-
-   if ( $languageFallbackChain === null ) {
-   $factory = 
WikibaseRepo::getDefaultInstance

[MediaWiki-commits] [Gerrit] Drop unused code from SpecialEntityDataTest - change (mediawiki...Wikibase)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175976

Change subject: Drop unused code from SpecialEntityDataTest
..

Drop unused code from SpecialEntityDataTest

If all tests succeed this can not be wrong, right?

This is split from I04767f2 to make it easier to review.

Change-Id: I1a6db4290f361e5c202a63031c6d3946c96be961
---
M repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
1 file changed, 4 insertions(+), 30 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/76/175976/1

diff --git a/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php 
b/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
index c43d7bf..0a1e5c0 100644
--- a/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
@@ -11,7 +11,6 @@
 use Title;
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Entity\Item;
 use Wikibase\EntityFactory;
 use Wikibase\Lib\Serializers\SerializationOptions;
 use Wikibase\Lib\Serializers\SerializerFactory;
@@ -19,7 +18,6 @@
 use Wikibase\Repo\LinkedData\EntityDataSerializationService;
 use Wikibase\Repo\LinkedData\EntityDataUriManager;
 use Wikibase\Repo\Specials\SpecialEntityData;
-use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\Repo\Specials\SpecialEntityData
@@ -40,28 +38,6 @@
const URI_BASE = 'http://acme.test/';
const URI_DATA = 'http://data.acme.test/';
 
-   protected function saveItem( Item $item ) {
-   //TODO: Same as in EntityDataRequestHandlerTest. Factor out.
-
-   $store = WikibaseRepo::getDefaultInstance()-getEntityStore();
-   $store-saveEntity( $item, testing, $GLOBALS['wgUser'], 
EDIT_NEW );
-   }
-
-   public function getTestItem() {
-   //TODO: Same as in EntityDataRequestHandlerTest. Factor out.
-
-   $prefix = get_class( $this ) . '/';
-   static $item;
-
-   if ( $item === null ) {
-   $item = Item::newEmpty();
-   $item-setLabel( 'en', $prefix . 'Raarrr' );
-   $this-saveItem( $item );
-   }
-
-   return $item;
-   }
-
protected function newSpecialPage() {
$page = new SpecialEntityData();
 
@@ -73,10 +49,8 @@
return $page;
}
 
-   protected function newRequestHandler() {
-   $mockRepo = EntityDataTestProvider::getMockRepository();
-
-   $entityRevisionLookup = $mockRepo;
+   private function newRequestHandler() {
+   $mockRepository = EntityDataTestProvider::getMockRepository();
 
$titleLookup = $this-getMock( 
'Wikibase\Lib\Store\EntityTitleLookup' );
$titleLookup-expects( $this-any() )
@@ -102,7 +76,7 @@
$serializationService = new EntityDataSerializationService(
self::URI_BASE,
self::URI_DATA,
-   $mockRepo,
+   $mockRepository,
$titleLookup,
$serializerFactory,
new SiteList()
@@ -130,7 +104,7 @@
$uriManager,
$titleLookup,
$idParser,
-   $entityRevisionLookup,
+   $mockRepository,
$serializationService,
$defaultFormat,
$maxAge,

-- 
To view, visit https://gerrit.wikimedia.org/r/175976
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a6db4290f361e5c202a63031c6d3946c96be961
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Clean up ChangeHandler - change (mediawiki...Wikibase)

2014-11-06 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/171569

Change subject: Clean up ChangeHandler
..

Clean up ChangeHandler

Change-Id: If258b63807930aacd89cd24da57a1a27648800d6
---
M client/includes/ChangeHandler.php
1 file changed, 27 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/69/171569/1

diff --git a/client/includes/ChangeHandler.php 
b/client/includes/ChangeHandler.php
index 95cc27b..b351085 100644
--- a/client/includes/ChangeHandler.php
+++ b/client/includes/ChangeHandler.php
@@ -65,7 +65,7 @@
private $affectedPagesFinder;
 
/**
-* @var Client\Store\TitleFactory
+* @var TitleFactory
 */
private $titleFactory;
 
@@ -84,6 +84,22 @@
 */
private $localSiteId;
 
+   /**
+* @var bool
+*/
+   private $injectRC;
+
+   /**
+* @param EntityChangeFactory $changeFactory
+* @param AffectedPagesFinder $affectedPagesFinder
+* @param TitleFactory $titleFactory
+* @param PageUpdater $updater
+* @param EntityRevisionLookup $entityRevisionLookup
+* @param string $localSiteId
+* @param bool $injectRC
+*
+* @throws InvalidArgumentException
+*/
public function __construct(
EntityChangeFactory $changeFactory,
AffectedPagesFinder $affectedPagesFinder,
@@ -93,12 +109,6 @@
$localSiteId,
$injectRC
) {
-   $this-changeFactory = $changeFactory;
-   $this-affectedPagesFinder = $affectedPagesFinder;
-   $this-titleFactory = $titleFactory;
-   $this-updater = $updater;
-   $this-entityRevisionLookup = $entityRevisionLookup;
-
if ( !is_string( $localSiteId ) ) {
throw new InvalidArgumentException( '$localSiteId must 
be a string' );
}
@@ -107,10 +117,13 @@
throw new InvalidArgumentException( '$injectRC must be 
a bool' );
}
 
+   $this-changeFactory = $changeFactory;
+   $this-affectedPagesFinder = $affectedPagesFinder;
+   $this-titleFactory = $titleFactory;
+   $this-updater = $updater;
+   $this-entityRevisionLookup = $entityRevisionLookup;
$this-localSiteId = $localSiteId;
-   $this-injectRC = (bool)$injectRC;
-
-   $this-mirrorUpdater = null;
+   $this-injectRC = $injectRC;
}
 
/**
@@ -308,7 +321,7 @@
 
$currentRun[] = $change;
// skip any change that failed to process in some way 
(bug 49417)
-   } catch ( \Exception $e ) {
+   } catch ( Exception $e ) {
wfLogWarning( __METHOD__ . ':' . 
$e-getMessage() );
}
}
@@ -601,7 +614,7 @@
 *
 * @since 0.4
 *
-* @param \Wikibase\EntityChange $change The Change that caused the 
update
+* @param EntityChange $change The Change that caused the update
 *
 * @return array|boolean an array of RC attributes,
 * or false if the change does not provide edit meta data
@@ -652,7 +665,7 @@
 *
 * @param EntityChange $change the change to get a comment for
 *
-* @throws \MWException
+* @throws MWException
 * @return array
 */
public function getEditComment( EntityChange $change ) {
@@ -667,7 +680,7 @@
 
$editComment = $commentCreator-getEditComment( $siteLinkDiff, 
$action, $comment );
if( is_array( $editComment )  !isset( $editComment['message'] 
) ) {
-   throw new \MWException( 'getEditComment returned an 
empty comment' );
+   throw new MWException( 'getEditComment returned an 
empty comment' );
}
 
return $editComment;

-- 
To view, visit https://gerrit.wikimedia.org/r/171569
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If258b63807930aacd89cd24da57a1a27648800d6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Narrow EntityParserOutputGeneratorFactory interface - change (mediawiki...Wikibase)

2014-11-10 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172275

Change subject: Narrow EntityParserOutputGeneratorFactory interface
..

Narrow EntityParserOutputGeneratorFactory interface

... to not require an EntityRevision object any more.

... and optimize imports.

Please merge this after Aude's patches to not cause unnecesarry
merge conflicts.

Change-Id: I3bc3a356c63c33bc82cf960b27eab77e1f86a03a
---
M repo/includes/ChangeOp/ChangeOpClaimRemove.php
M repo/includes/Diff/ClaimDifferenceVisualizer.php
M repo/includes/EntityParserOutputGenerator.php
M repo/includes/EntityParserOutputGeneratorFactory.php
M repo/includes/Interactors/RedirectCreationInteractor.php
M repo/includes/LinkedData/EntityDataSerializationService.php
M repo/includes/ParserOutputJsConfigBuilder.php
M repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php
M repo/includes/View/SnakHtmlGenerator.php
M repo/includes/WikibaseRepo.php
M repo/includes/api/ApiHelperFactory.php
M repo/includes/api/ApiWikibase.php
M repo/includes/api/ClaimModificationHelper.php
M repo/includes/content/EntityContent.php
M repo/includes/content/EntityHandler.php
M repo/includes/content/ItemContent.php
M repo/includes/content/PropertyContent.php
M repo/includes/store/sql/SqlStore.php
M repo/tests/phpunit/includes/EntityParserOutputGeneratorFactoryTest.php
19 files changed, 38 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/75/172275/1

diff --git a/repo/includes/ChangeOp/ChangeOpClaimRemove.php 
b/repo/includes/ChangeOp/ChangeOpClaimRemove.php
index ddc2d53..0e6c727 100644
--- a/repo/includes/ChangeOp/ChangeOpClaimRemove.php
+++ b/repo/includes/ChangeOp/ChangeOpClaimRemove.php
@@ -8,7 +8,6 @@
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\Property;
-use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\StatementList;
 use Wikibase\Summary;
diff --git a/repo/includes/Diff/ClaimDifferenceVisualizer.php 
b/repo/includes/Diff/ClaimDifferenceVisualizer.php
index 808dc24..2a34f46 100644
--- a/repo/includes/Diff/ClaimDifferenceVisualizer.php
+++ b/repo/includes/Diff/ClaimDifferenceVisualizer.php
@@ -2,11 +2,11 @@
 
 namespace Wikibase\Repo\Diff;
 
+use Diff\Differ\ListDiffer;
 use Diff\DiffOp\Diff\Diff;
 use Diff\DiffOp\DiffOpAdd;
 use Diff\DiffOp\DiffOpChange;
 use Diff\DiffOp\DiffOpRemove;
-use Diff\Differ\ListDiffer;
 use Exception;
 use InvalidArgumentException;
 use Message;
diff --git a/repo/includes/EntityParserOutputGenerator.php 
b/repo/includes/EntityParserOutputGenerator.php
index 447484b..be239ae 100644
--- a/repo/includes/EntityParserOutputGenerator.php
+++ b/repo/includes/EntityParserOutputGenerator.php
@@ -3,9 +3,10 @@
 namespace Wikibase;
 
 use ParserOutput;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
+use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\SiteLinkList;
 use Wikibase\Lib\Serializers\SerializationOptions;
 use Wikibase\Lib\Store\EntityInfoBuilderFactory;
@@ -170,7 +171,7 @@
 * @since 0.4
 *
 * @param EntityId[] $entityIds
-* @return array obtained from EntityInfoBuilder::getEntityInfo
+* @return array[] obtained from EntityInfoBuilder::getEntityInfo
 */
private function getEntityInfo( array $entityIds ) {
wfProfileIn( __METHOD__ );
@@ -196,6 +197,7 @@
}
 
private function addBadgesToParserOutput( ParserOutput $pout, 
SiteLinkList $siteLinkList ) {
+   /** @var SiteLink $siteLink */
foreach ( $siteLinkList as $siteLink ) {
foreach ( $siteLink-getBadges() as $badge ) {
$pout-addLink( 
$this-entityTitleLookup-getTitleForId( $badge ) );
@@ -203,13 +205,13 @@
}
}
 
-   private function addHtmlToParserOutput( ParserOutput $pout, 
EntityRevision $entityRevision, $editable ) {
+   private function addHtmlToParserOutput( ParserOutput $pout, 
EntityRevision $entityRevision, $editable = true ) {
$html = $this-entityView-getHtml( $entityRevision, $editable 
);
$pout-setText( $html );
$pout-setExtensionData( 'wikibase-view-chunks', 
$this-entityView-getPlaceholders() );
}
 
-   private function addModules( ParserOutput $pout, $editable ) {
+   private function addModules( ParserOutput $pout, $editable = true ) {
// make css available for JavaScript-less browsers
$pout-addModuleStyles( array(
'wikibase.common',
diff --git a/repo/includes/EntityParserOutputGeneratorFactory.php 
b/repo/includes

[MediaWiki-commits] [Gerrit] Simplify remoteExtPath regex - change (mediawiki...Wikibase)

2014-11-10 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172289

Change subject: Simplify remoteExtPath regex
..

Simplify remoteExtPath regex

The complexity of this regular expression is just not needed. Just
search for the first occurrence of `/vendor/` or `/extensions/`
and match everything from there, that's it.

Using a regex character (`+`) as delimiter does have the advantage
that it must not be repeated when calling `preg_quote`, it's always
quoted.

Change-Id: Icbcc490879779bd6de64856411fcd862454347d4
---
M client/WikibaseClient.hooks.php
M client/resources/Resources.php
M lib/resources/Resources.php
M lib/resources/api/resources.php
M lib/resources/entityChangers/resources.php
M lib/resources/experts/resources.php
M lib/resources/formatters/resources.php
M lib/resources/jquery.wikibase/resources.php
M lib/resources/jquery.wikibase/snakview/resources.php
M lib/resources/jquery.wikibase/toolbar/resources.php
M lib/resources/parsers/resources.php
M lib/resources/wikibase.RepoApi/resources.php
M lib/resources/wikibase.store/resources.php
M lib/resources/wikibase.utilities/resources.php
M repo/resources/Resources.php
15 files changed, 54 insertions(+), 105 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/89/172289/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 8f6b491..c3752ba 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -501,14 +501,10 @@
public static function onGetBetaFeaturePreferences( User $user, array 
$betaPreferences ) {
global $wgExtensionAssetsPath;
 
-preg_match(
-'+' . preg_quote( DIRECTORY_SEPARATOR, '+' ) . 
'((?:vendor|extensions)' .
-preg_quote( DIRECTORY_SEPARATOR, '+' ) . 
'.*)$+',
-__DIR__,
-$remoteExtPathParts
-);
+   preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) . 
'(?:vendor|extensions)'
+   . preg_quote( DIRECTORY_SEPARATOR ) . '.*+', __DIR__, 
$remoteExtPath );
 
-   $assetsPath = $wgExtensionAssetsPath . DIRECTORY_SEPARATOR . 
'..' . DIRECTORY_SEPARATOR . $remoteExtPathParts[1];
+   $assetsPath = $wgExtensionAssetsPath . DIRECTORY_SEPARATOR . 
'..' . $remoteExtPath[0];
 
$settings = WikibaseClient::getDefaultInstance()-getSettings();
if ( !$settings-getSetting( 'otherProjectsLinksBeta' ) || 
$settings-getSetting( 'otherProjectsLinksByDefault' ) ) {
diff --git a/client/resources/Resources.php b/client/resources/Resources.php
index 2c90075..7cbf1b0 100644
--- a/client/resources/Resources.php
+++ b/client/resources/Resources.php
@@ -1,15 +1,12 @@
 ?php
 
 return call_user_func( function() {
-   preg_match(
-   '+' . preg_quote( DIRECTORY_SEPARATOR, '+' ) . 
'((?:vendor|extensions)' .
-   preg_quote( DIRECTORY_SEPARATOR, '+' ) . '.*)$+',
-   __DIR__,
-   $remoteExtPathParts
-   );
+   preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) . 
'(?:vendor|extensions)'
+   . preg_quote( DIRECTORY_SEPARATOR ) . '.*+', __DIR__, 
$remoteExtPath );
+
$moduleTemplate = array(
'localBasePath' = __DIR__,
-   'remoteExtPath' = '..' . DIRECTORY_SEPARATOR . 
$remoteExtPathParts[1],
+   'remoteExtPath' = '..' . $remoteExtPath[0],
);
 
return array(
diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index bd7ce2a..31dcb2e 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -11,15 +11,12 @@
  * @codeCoverageIgnoreStart
  */
 return call_user_func( function() {
-   preg_match(
-   '+' . preg_quote( DIRECTORY_SEPARATOR, '+' ) . 
'((?:vendor|extensions)' .
-   preg_quote( DIRECTORY_SEPARATOR, '+' ) . '.*)$+',
-   __DIR__,
-   $remoteExtPathParts
-   );
+   preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) . 
'(?:vendor|extensions)'
+   . preg_quote( DIRECTORY_SEPARATOR ) . '.*+', __DIR__, 
$remoteExtPath );
+
$moduleTemplate = array(
'localBasePath' = __DIR__,
-   'remoteExtPath' = '..' . DIRECTORY_SEPARATOR . 
$remoteExtPathParts[1],
+   'remoteExtPath' = '..' . $remoteExtPath[0],
);
 
$modules = array(
diff --git a/lib/resources/api/resources.php b/lib/resources/api/resources.php
index 1b0236a..f0e901c 100644
--- a/lib/resources/api/resources.php
+++ b/lib/resources/api/resources.php
@@ -4,16 +4,12 @@
  * @author Adrian Lang adrian.l...@wikimedia.de
  */
 return call_user_func( function() {
+   preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) . 
'(?:vendor|extensions

[MediaWiki-commits] [Gerrit] Consistent SiteLink naming and dead code removed - change (mediawiki...Wikibase)

2014-11-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172541

Change subject: Consistent SiteLink naming and dead code removed
..

Consistent SiteLink naming and dead code removed

I started this patch with uppercasing some L in $siteLink
variable names and cleaned some more code I came accross while
doing this.

Change-Id: I176df356f2f6a48a79d35327c3786597ed9923fd
---
M lib/includes/serializers/AliasSerializer.php
M lib/includes/serializers/ByPropertyListSerializer.php
M lib/includes/serializers/ByPropertyListUnserializer.php
M lib/includes/serializers/ClaimsSerializer.php
M lib/includes/serializers/DescriptionSerializer.php
M lib/includes/serializers/EntitySerializer.php
M lib/includes/serializers/ItemSerializer.php
M lib/includes/serializers/LabelSerializer.php
M lib/includes/serializers/ListSerializer.php
M lib/includes/serializers/ListUnserializer.php
M lib/includes/serializers/MultilingualSerializer.php
M lib/includes/serializers/ReferenceSerializer.php
M lib/includes/serializers/SerializerObject.php
M lib/includes/serializers/SiteLinkSerializer.php
M lib/includes/serializers/SnakSerializer.php
M lib/tests/phpunit/serializers/SiteLinkSerializerTest.php
M lib/tests/phpunit/store/SiteLinkTableTest.php
M lib/tests/phpunit/store/SqlEntityInfoBuilderTest.php
M repo/includes/api/EditEntity.php
M repo/includes/api/ResultBuilder.php
M repo/includes/specials/SpecialDispatchStats.php
M repo/includes/specials/SpecialItemResolver.php
M repo/tests/phpunit/includes/api/GetEntitiesTest.php
M repo/tests/phpunit/includes/api/ResultBuilderTest.php
M repo/tests/phpunit/includes/api/SetSiteLinkTest.php
25 files changed, 111 insertions(+), 146 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/41/172541/1

diff --git a/lib/includes/serializers/AliasSerializer.php 
b/lib/includes/serializers/AliasSerializer.php
index 9cf8b4f..8fef354 100644
--- a/lib/includes/serializers/AliasSerializer.php
+++ b/lib/includes/serializers/AliasSerializer.php
@@ -18,17 +18,6 @@
 class AliasSerializer extends SerializerObject implements Unserializer {
 
/**
-* Constructor.
-*
-* @since 0.4
-*
-* @param SerializationOptions $options
-*/
-   public function __construct( SerializationOptions $options = null ) {
-   parent::__construct( $options );
-   }
-
-   /**
 * Returns a serialized array of aliases.
 *
 * @since 0.4
@@ -136,4 +125,5 @@
 
return $aliases;
}
+
 }
diff --git a/lib/includes/serializers/ByPropertyListSerializer.php 
b/lib/includes/serializers/ByPropertyListSerializer.php
index 86bce1a..8c4e5e6 100644
--- a/lib/includes/serializers/ByPropertyListSerializer.php
+++ b/lib/includes/serializers/ByPropertyListSerializer.php
@@ -20,29 +20,27 @@
const OPT_ADD_LOWER_CASE_KEYS = 'addLowerCaseKeys';
 
/**
-* @since 0.2
-*
 * @var string
 */
-   protected $elementName;
+   private $elementName;
 
/**
-* @since 0.2
-*
 * @var Serializer
 */
-   protected $elementSerializer;
+   private $elementSerializer;
 
/**
-* Constructor.
-*
 * @since 0.2
 *
 * @param string $elementName
 * @param Serializer $elementSerializer
 * @param SerializationOptions|null $options
 */
-   public function __construct( $elementName, Serializer 
$elementSerializer, SerializationOptions $options = null ) {
+   public function __construct(
+   $elementName,
+   Serializer $elementSerializer,
+   SerializationOptions $options = null
+   ) {
parent::__construct( $options );
 
$this-elementName = $elementName;
diff --git a/lib/includes/serializers/ByPropertyListUnserializer.php 
b/lib/includes/serializers/ByPropertyListUnserializer.php
index 820abf3..a645188 100644
--- a/lib/includes/serializers/ByPropertyListUnserializer.php
+++ b/lib/includes/serializers/ByPropertyListUnserializer.php
@@ -22,11 +22,9 @@
 *
 * @var Serializer
 */
-   protected $elementUnserializer;
+   private $elementUnserializer;
 
/**
-* Constructor.
-*
 * @since 0.2
 *
 * @param Unserializer $elementUnserializer
diff --git a/lib/includes/serializers/ClaimsSerializer.php 
b/lib/includes/serializers/ClaimsSerializer.php
index 4f2b08a..d2e04be 100644
--- a/lib/includes/serializers/ClaimsSerializer.php
+++ b/lib/includes/serializers/ClaimsSerializer.php
@@ -39,7 +39,7 @@
 *
 * @since 0.2
 *
-* @param mixed $claims
+* @param Claims $claims
 *
 * @return array
 * @throws InvalidArgumentException
diff --git a/lib/includes

[MediaWiki-commits] [Gerrit] Add irc to the allowed URL schemas - change (mediawiki...Wikibase)

2014-11-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172545

Change subject: Add irc to the allowed URL schemas
..

Add irc to the allowed URL schemas

I considered adding this to the operations/mediawiki-config, but
why not simply allow irc by default?

Please note that I currently don't want to add mailto by default,
mainly for privacy reasons.

Needs Ib9daa61.

Bug: 72924
Change-Id: I86cff20d3826f90cdbb3086975b5fa8be4a24eac
---
M lib/config/WikibaseLib.default.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/45/172545/1

diff --git a/lib/config/WikibaseLib.default.php 
b/lib/config/WikibaseLib.default.php
index 37240c8..d65c575 100644
--- a/lib/config/WikibaseLib.default.php
+++ b/lib/config/WikibaseLib.default.php
@@ -101,7 +101,7 @@
 
// URL schemes allowed for values of the URL type.
// Supported types include 'http', 'https', 'ftp', and 'mailto'.
-   'urlSchemes' = array( 'http', 'https', 'ftp' )
+   'urlSchemes' = array( 'ftp', 'http', 'https', 'irc' )
 );
 
 // experimental stuff

-- 
To view, visit https://gerrit.wikimedia.org/r/172545
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86cff20d3826f90cdbb3086975b5fa8be4a24eac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove my email address - change (mediawiki...Wikibase)

2014-11-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172564

Change subject: Remove my email address
..

Remove my email address

I did this for a very short time and later decided to not put my
email address anywhere. My name is very easy to google if somebody
needs/wants to contact me.

Change-Id: I5ac3be71f28205704097197321c608c38ba7b561
---
M repo/includes/ContentRetriever.php
M repo/includes/api/SearchEntities.php
M repo/resources/themes/default/wikibase.toc.css
3 files changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/64/172564/1

diff --git a/repo/includes/ContentRetriever.php 
b/repo/includes/ContentRetriever.php
index 173d36a..75bbbd1 100644
--- a/repo/includes/ContentRetriever.php
+++ b/repo/includes/ContentRetriever.php
@@ -17,7 +17,7 @@
  *
  * @licence GNU GPL v2+
  * @author Katie Filbert  aude.w...@gmail.com 
- * @author Thiemo Mättig  thiemo.maet...@wikimedia.de 
+ * @author Thiemo Mättig
  */
 class ContentRetriever {
 
diff --git a/repo/includes/api/SearchEntities.php 
b/repo/includes/api/SearchEntities.php
index 253ea57..d09863d 100644
--- a/repo/includes/api/SearchEntities.php
+++ b/repo/includes/api/SearchEntities.php
@@ -29,7 +29,7 @@
  * @author John Erling Blad  jeb...@gmail.com 
  * @author Jens Ohlig  jens.oh...@wikimedia.de 
  * @author Tobias Gritschacher  tobias.gritschac...@wikimedia.de 
- * @author Thiemo Mättig  thiemo.maet...@wikimedia.de 
+ * @author Thiemo Mättig
  */
 class SearchEntities extends ApiBase {
 
diff --git a/repo/resources/themes/default/wikibase.toc.css 
b/repo/resources/themes/default/wikibase.toc.css
index 213eebe..c8ed95a 100644
--- a/repo/resources/themes/default/wikibase.toc.css
+++ b/repo/resources/themes/default/wikibase.toc.css
@@ -3,7 +3,7 @@
  *
  * @licence GNU GPL v2+
  * @author H. Snater  mediaw...@snater.com 
- * @author T. Mättig  thiemo.maet...@wikimedia.de 
+ * @author Thiemo Mättig
  */
 
 .wikibase-entityview #toc {

-- 
To view, visit https://gerrit.wikimedia.org/r/172564
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ac3be71f28205704097197321c608c38ba7b561
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] More consistent variable naming, e.g. $languageCode - change (mediawiki...Wikibase)

2014-11-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172572

Change subject: More consistent variable naming, e.g. $languageCode
..

More consistent variable naming, e.g. $languageCode

* Renamed some variables, e.g. $language if it does not contain a
  Language object.
* Make use of PHP 5.3's short ?: operator.
* Made some stuff private that just does not need to be protected.

Change-Id: I0cb5068d72bb64578ee1e721720e16bae7916b47
---
M client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
M repo/includes/specials/SpecialItemByTitle.php
M repo/includes/specials/SpecialItemDisambiguation.php
M repo/includes/specials/SpecialModifyTerm.php
M repo/includes/specials/SpecialNewEntity.php
M repo/includes/specials/SpecialSetAliases.php
M repo/includes/specials/SpecialSetDescription.php
M repo/includes/specials/SpecialSetLabel.php
9 files changed, 78 insertions(+), 81 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/72/172572/1

diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
index 236fe9d..2c7e1f4 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
@@ -56,7 +56,7 @@
 
return new WikibaseLuaBindings(
new BasicEntityIdParser(),
-   $entityLookup ? $entityLookup : new MockRepository(),
+   $entityLookup ?: new MockRepository(),
$siteLinkTable,
new LanguageFallbackChainFactory(),
$language, // language
diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
index 4662ee6..db85aef 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
@@ -39,7 +39,7 @@
 
return new WikibaseLuaEntityBindings(
$this-newSnakFormatterMock(),
-   $entityLookup ? $entityLookup : new MockRepository(),
+   $entityLookup ?: new MockRepository(),
'enwiki',
$language // language
);
diff --git a/repo/includes/specials/SpecialItemByTitle.php 
b/repo/includes/specials/SpecialItemByTitle.php
index e274cd1..abf92d7 100644
--- a/repo/includes/specials/SpecialItemByTitle.php
+++ b/repo/includes/specials/SpecialItemByTitle.php
@@ -75,12 +75,12 @@
 * Initialize essential settings for this special page.
 * may be used by unit tests to override global settings.
 *
-* @param $normalizeItemByTitlePageNames
-* @param $siteLinkGroups
+* @param bool $normalizeItemByTitlePageNames
+* @param string[] $siteLinkGroups
 */
public function initSettings(
$normalizeItemByTitlePageNames,
-   $siteLinkGroups
+   array $siteLinkGroups
) {
$this-normalizeItemByTitlePageNames = 
$normalizeItemByTitlePageNames;
$this-groups = $siteLinkGroups;
@@ -170,7 +170,7 @@
 * @param string $siteId
 * @param string $page
 */
-   protected function switchForm( $siteId, $page ) {
+   private function switchForm( $siteId, $page ) {
if ( $this-sites-getSites()-hasSite( $siteId ) ) {
$site = $this-sites-getSite( $siteId );
$siteExists = in_array( $site-getGroup(), 
$this-groups );
@@ -246,8 +246,8 @@
Html::openElement( 'div' )
. $this-msg( 'wikibase-itembytitle-create' )
-params(
-   wfUrlencode( $siteId ? $siteId 
: '' ),
-   wfUrlencode( $page ? $page : '' 
)
+   wfUrlencode( $siteId ?: '' ),
+   wfUrlencode( $page ?: '' )
)
-parse()
. Html::closeElement( 'div' )
diff --git a/repo/includes/specials/SpecialItemDisambiguation.php 
b/repo/includes/specials/SpecialItemDisambiguation.php
index 7dc0843..a01ab73 100644
--- a/repo/includes/specials/SpecialItemDisambiguation.php
+++ b/repo/includes/specials/SpecialItemDisambiguation.php
@@ -54,7 +54,6 @@
 * @since 0.1
 */
public function

[MediaWiki-commits] [Gerrit] Add missing test resources - change (mediawiki...WikibaseJavaScriptApi)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Add missing test resources
..


Add missing test resources

Change-Id: I8b3309efce1602a1901072b869c59167638c3a1b
---
M resources.php
A tests/resources.php
2 files changed, 49 insertions(+), 1 deletion(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/resources.php b/resources.php
index a3be346..143b2aa 100644
--- a/resources.php
+++ b/resources.php
@@ -9,7 +9,9 @@
  */
 return call_user_func( function() {
global $wgResourceModules;
+
$wgResourceModules = array_merge(
$wgResourceModules,
-   include 'src/resources.php'
+   include( __DIR__ . '/src/resources.php' )
);
+} );
diff --git a/tests/resources.php b/tests/resources.php
new file mode 100644
index 000..dabdcc7
--- /dev/null
+++ b/tests/resources.php
@@ -0,0 +1,46 @@
+?php
+
+/**
+ * @licence GNU GPL v2+
+ * @author H. Snater  mediaw...@snater.com 
+ *
+ * @codeCoverageIgnoreStart
+ */
+return call_user_func( function() {
+   preg_match( '+' . preg_quote( DIRECTORY_SEPARATOR ) . 
'(?:vendor|extensions)'
+   . preg_quote( DIRECTORY_SEPARATOR ) . '.*+', __DIR__, 
$remoteExtPath );
+
+   $moduleTemplate = array(
+   'localBasePath' = __DIR__,
+   'remoteExtPath' = '..' . $remoteExtPath[0],
+   );
+
+   return array(
+   'wikibase.api.RepoApi.tests' = $moduleTemplate + array(
+   'scripts' = array(
+   'RepoApi.tests.js',
+   ),
+   'dependencies' = array(
+   'wikibase',
+   'wikibase.api.getLocationAgnosticMwApi',
+   'wikibase.api.RepoApi',
+   ),
+   ),
+
+   'wikibase.api.RepoApiError.tests' = $moduleTemplate + array(
+   'scripts' = array(
+   'RepoApiError.tests.js',
+   ),
+   'dependencies' = array(
+   'wikibase',
+   'wikibase.api.RepoApiError',
+   ),
+   'messages' = array(
+   'wikibase-error-unexpected',
+   'wikibase-error-remove-timeout',
+   'wikibase-error-ui-client-error',
+   ),
+   ),
+   );
+
+} );

-- 
To view, visit https://gerrit.wikimedia.org/r/175986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8b3309efce1602a1901072b869c59167638c3a1b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Bump data-values/javascript dependency to match Wikibase.git's - change (mediawiki...WikibaseJavaScriptApi)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Bump data-values/javascript dependency to match Wikibase.git's
..


Bump data-values/javascript dependency to match Wikibase.git's

Change-Id: I1af31b10940abd59482756b15fddc8593a1280ef
---
M composer.json
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/composer.json b/composer.json
index 9f00d97..a01d814 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
name: wikibase/javascript-api,
description: Wikibase API client in JavaScript,
require: {
-   data-values/javascript: ~0.5.0
+   data-values/javascript: ~0.6.0
},
license: GPL-2.0+,
authors: [

-- 
To view, visit https://gerrit.wikimedia.org/r/175991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1af31b10940abd59482756b15fddc8593a1280ef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Remove dependency on wikibase resource loader module - change (mediawiki...WikibaseJavaScriptApi)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Remove dependency on wikibase resource loader module
..


Remove dependency on wikibase resource loader module

Change-Id: Ie0da9c09def233acc7fb08a3ccbe712146eb08f4
---
M src/namespace.js
M src/resources.php
M tests/resources.php
3 files changed, 4 insertions(+), 6 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/src/namespace.js b/src/namespace.js
index 3991d16..bf080a4 100644
--- a/src/namespace.js
+++ b/src/namespace.js
@@ -1,5 +1,6 @@
-( function( wb ) {
+( function( global ) {
'use strict';
 
-   wb.api = {};
-}( wikibase ) );
+   global.wikibase = global.wikibase || {};
+   global.wikibase.api = global.wikibase.api || {};
+}( this ) );
diff --git a/src/resources.php b/src/resources.php
index 86ddd23..7dcde07 100644
--- a/src/resources.php
+++ b/src/resources.php
@@ -19,7 +19,6 @@
'namespace.js'
),
'dependencies' = array(
-   'wikibase' // For the namespace
)
),
 
diff --git a/tests/resources.php b/tests/resources.php
index dabdcc7..9a787a5 100644
--- a/tests/resources.php
+++ b/tests/resources.php
@@ -21,7 +21,6 @@
'RepoApi.tests.js',
),
'dependencies' = array(
-   'wikibase',
'wikibase.api.getLocationAgnosticMwApi',
'wikibase.api.RepoApi',
),
@@ -32,7 +31,6 @@
'RepoApiError.tests.js',
),
'dependencies' = array(
-   'wikibase',
'wikibase.api.RepoApiError',
),
'messages' = array(

-- 
To view, visit https://gerrit.wikimedia.org/r/175994
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0da9c09def233acc7fb08a3ccbe712146eb08f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Shorten overly long lines - change (mediawiki...WikibaseJavaScriptApi)

2014-11-26 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Shorten overly long lines
..


Shorten overly long lines

Change-Id: I0dde5d6251420bf43636a1e8e0f19f44592aa7e7
---
M .jshintrc
M src/FormatValueCaller.js
M src/ParseValueCaller.js
M src/RepoApi.js
M tests/RepoApi.tests.js
5 files changed, 19 insertions(+), 11 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/.jshintrc b/.jshintrc
index e1e7c3e..a5afa4d 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -50,7 +50,7 @@
 
indent: 4,
quotmark: false,
-   maxlen: 110,
+   maxlen: 100,
maxparams: 7,
maxdepth: 4,
maxstatements: 19,
diff --git a/src/FormatValueCaller.js b/src/FormatValueCaller.js
index 9836a1f..0f44558 100644
--- a/src/FormatValueCaller.js
+++ b/src/FormatValueCaller.js
@@ -31,9 +31,9 @@
_dataTypeStore: null,
 
/**
-* Makes a request to the API to format values on the server 
side. Will return a jQuery.Promise
-* which will be resolved if formatting is successful or 
rejected if it fails or the API cannot
-* be reached.
+* Makes a request to the API to format values on the server 
side. Will return a
+* jQuery.Promise which will be resolved if formatting is 
successful or rejected if it fails
+* or the API cannot be reached.
 * @since 0.5
 *
 * @param {dataValues.DataValue} dataValue
diff --git a/src/ParseValueCaller.js b/src/ParseValueCaller.js
index 07cb134..01f06b4 100644
--- a/src/ParseValueCaller.js
+++ b/src/ParseValueCaller.js
@@ -28,7 +28,8 @@
 
/**
 * Makes a request to the API to parse values on the server side. Will 
return a jQuery.Promise
-* which will be resolved if the call is successful or rejected if the 
API fails or can't be reached.
+* which will be resolved if the call is successful or rejected if the 
API fails or can't be
+* reached.
 * @since 0.5
 *
 * @param {string} parser
@@ -61,8 +62,8 @@
 
if( result.error ) {
// This is a really strange error 
format, and it's not supported by
-   // 
wikibase.api.RepoApiError.newFromApiResponse, so we have to parse it manually 
here.
-   // See bug 72947.
+   // 
wikibase.api.RepoApiError.newFromApiResponse, so we have to parse it manually
+   // here. See bug 72947.
deferred.reject( new 
wb.api.RepoApiError(
result.messages[0].name,
result.messages[0].html['*']
@@ -71,7 +72,10 @@
}
 
if( !( result.value  result.type ) ) {
-   deferred.reject( new 
wb.api.RepoApiError( 'result-unexpected', 'Unknown API error' ) );
+   deferred.reject( new 
wb.api.RepoApiError(
+   'result-unexpected',
+   'Unknown API error'
+   ) );
return;
}
 
diff --git a/src/RepoApi.js b/src/RepoApi.js
index 8b09a27..4baf3f8 100644
--- a/src/RepoApi.js
+++ b/src/RepoApi.js
@@ -316,7 +316,7 @@
/**
 * Removes an existing claim.
 *
-* @param {String} claimGuid The GUID of the Claim to be removed 
(wikibase.datamodel.Claim.getGuid)
+* @param {String} claimGuid The GUID of the Claim to be removed
 * @param {Number} [claimRevisionId]
 * @return {jQuery.Promise}
 */
@@ -356,7 +356,7 @@
/**
 * Changes the Main Snak of an existing claim.
 *
-* @param {string} claimGuid The GUID of the Claim to be changed 
(wikibase.datamodel.Claim.getGuid)
+* @param {string} claimGuid The GUID of the Claim to be changed
 * @param {number} baseRevId
 * @param {string} snakType The type of the snak
 * @param {string} property Id of the snak's property
diff --git a/tests/RepoApi.tests.js b/tests/RepoApi.tests.js
index 0ae19f5..e59aa83 100644
--- a/tests/RepoApi.tests.js
+++ b/tests/RepoApi.tests.js
@@ -454,7 +454,11 @@
 
testrun.queue( qkey, function() {
api.setAliases(
-   entityStack[0].id, entityStack[0].lastrevid, [ 
'alias1', 'alias2' ], [], 'doesnotexist'
+   entityStack[0].id,
+   entityStack

[MediaWiki-commits] [Gerrit] Fix broken @see in Number(Un)Localizer doc - change (mediawiki...Wikibase)

2014-11-27 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176230

Change subject: Fix broken @see in Number(Un)Localizer doc
..

Fix broken @see in Number(Un)Localizer doc

Also see https://github.com/DataValues/Number/pull/14

Change-Id: Iad716fb67f14980b35ab32e2a333cfb00a8eee81
---
M lib/includes/formatters/MediaWikiNumberLocalizer.php
M lib/includes/parsers/MediaWikiNumberUnlocalizer.php
2 files changed, 11 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/30/176230/1

diff --git a/lib/includes/formatters/MediaWikiNumberLocalizer.php 
b/lib/includes/formatters/MediaWikiNumberLocalizer.php
index c23eeb3..a6c0d70 100644
--- a/lib/includes/formatters/MediaWikiNumberLocalizer.php
+++ b/lib/includes/formatters/MediaWikiNumberLocalizer.php
@@ -19,7 +19,7 @@
/**
 * @var Language
 */
-   protected $language;
+   private $language;
 
/**
 * @param Language $language
@@ -29,17 +29,16 @@
}
 
/**
-* @see Localizer::localize()
+* @see NumberLocalizer::localizeNumber
 *
-* @since 0.5
+* @param string|int|float $number
 *
-* @param string $number a numeric string
-*
-* @return string
 * @throws InvalidArgumentException
+* @return string
 */
public function localizeNumber( $number ) {
-   $localiezdNumber = $this-language-formatNum( $number );
-   return $localiezdNumber;
+   $localizedNumber = $this-language-formatNum( $number );
+   return $localizedNumber;
}
+
 }
diff --git a/lib/includes/parsers/MediaWikiNumberUnlocalizer.php 
b/lib/includes/parsers/MediaWikiNumberUnlocalizer.php
index 25e91e0..691bf2e 100644
--- a/lib/includes/parsers/MediaWikiNumberUnlocalizer.php
+++ b/lib/includes/parsers/MediaWikiNumberUnlocalizer.php
@@ -1,12 +1,11 @@
 ?php
 
 namespace Wikibase\Lib;
+
 use Language;
 use ValueParsers\BasicNumberUnlocalizer;
 
 /**
- * MediaWikiNumberUnlocalizer
- *
  * @since 0.5
  *
  * @license GPL 2+
@@ -33,11 +32,11 @@
}
 
/**
-* @see Unlocalizer::unlocalize()
+* @see NumberUnlocalizer::unlocalizeNumber
 *
 * @param string $number string to process
 *
-* @return string unlocalized string
+* @return string unlocalized number, in a form suitable for floatval 
resp. intval.
 */
public function unlocalizeNumber( $number ) {
$canonicalizedNumber = $this-language-parseFormattedNumber( 
$number );
@@ -52,7 +51,7 @@
}
 
/**
-* @see Unlocalizer::getNumberRegex()
+* @see NumberUnlocalizer::getNumberRegex
 *
 * Constructs a regular expression based on 
Language::digitTransformTable()
 * and Language::separatorTransformTable().

-- 
To view, visit https://gerrit.wikimedia.org/r/176230
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad716fb67f14980b35ab32e2a333cfb00a8eee81
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [WIP] Clean up UsageTablePrimer and related - change (mediawiki...Wikibase)

2014-11-28 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176356

Change subject: [WIP] Clean up UsageTablePrimer and related
..

[WIP] Clean up UsageTablePrimer and related

Two problems to be discussed:
1. Why must the addExtensionUpdate be static?
2. Why is the table name passed around as a variable in so many odd
   places?

Change-Id: Icf85ad8ed940a95ba741f2640d06ab506d563dd4
---
M client/includes/Usage/Sql/SqlUsageTracker.php
R client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
M client/includes/Usage/Sql/UsageTablePrimer.php
M client/includes/Usage/Sql/UsageTableUpdater.php
M client/includes/Usage/UsageTracker.php
M client/tests/phpunit/includes/Usage/EntityUsageTest.php
M client/tests/phpunit/includes/Usage/HashUsageAccumulatorTest.php
M client/tests/phpunit/includes/Usage/ParserOutputUsageAccumulatorTest.php
M client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
M client/tests/phpunit/includes/Usage/Sql/UsageTablePrimerTest.php
M client/tests/phpunit/includes/Usage/Sql/UsageTableUpdaterTest.php
M client/tests/phpunit/includes/Usage/UsageAccumulatorContractTester.php
M client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
M client/tests/phpunit/includes/Usage/UsageTrackerContractTester.php
14 files changed, 55 insertions(+), 70 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/56/176356/1

diff --git a/client/includes/Usage/Sql/SqlUsageTracker.php 
b/client/includes/Usage/Sql/SqlUsageTracker.php
index b29c94b..b907c77 100644
--- a/client/includes/Usage/Sql/SqlUsageTracker.php
+++ b/client/includes/Usage/Sql/SqlUsageTracker.php
@@ -54,7 +54,7 @@
 * @return UsageTableUpdater
 */
private function newTableUpdater( DatabaseBase $db ) {
-   return new UsageTableUpdater( $db, 'wbc_entity_usage', 
$this-batchSize );
+   return new UsageTableUpdater( $db, $this-batchSize );
}
 
/**
@@ -187,7 +187,7 @@
}
 
$res = $db-select(
-   'wbc_entity_usage',
+   UsageTracker::TABLE_NAME,
array( 'eu_aspect', 'eu_entity_id' ),
array( 'eu_page_id' = (int)$pageId ),
__METHOD__
@@ -239,7 +239,7 @@
$db = $this-connectionManager-getReadConnection();
 
$res = $db-select(
-   'wbc_entity_usage',
+   UsageTracker::TABLE_NAME,
array( 'DISTINCT eu_page_id' ),
$where,
__METHOD__
@@ -291,7 +291,7 @@
$db = $this-connectionManager-getReadConnection();
 
$res = $db-select(
-   'wbc_entity_usage',
+   UsageTracker::TABLE_NAME,
array( 'eu_entity_id' ),
$where,
__METHOD__
diff --git a/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php 
b/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
similarity index 71%
rename from client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
rename to client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
index 79fe713..662581a 100644
--- a/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
+++ b/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
@@ -3,6 +3,8 @@
 namespace Wikibase\Client\Usage\Sql;
 
 use DatabaseUpdater;
+use MWException;
+use Wikibase\Client\Usage\UsageTracker;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityIdParser;
 
@@ -48,36 +50,27 @@
 * Applies any schema updates
 */
public function doSchemaUpdate() {
-   $table = 'wbc_entity_usage';
-
-   if ( !$this-dbUpdater-tableExists( $table ) ) {
+   if ( !$this-dbUpdater-tableExists( UsageTracker::TABLE_NAME ) 
) {
$db = $this-dbUpdater-getDB();
$script = $this-getUpdateScriptPath( 'entity_usage', 
$db-getType() );
-   $this-dbUpdater-addExtensionTable( $table, $script );
+   $this-dbUpdater-addExtensionTable( 
UsageTracker::TABLE_NAME, $script );
 
// Register function for populating the table.
-   // Note that this must be done with a static function,
-   // for reasons that do not need explaining at this 
juncture.
-   $this-dbUpdater-addExtensionUpdate( array(
-   array( __CLASS__, 'fillUsageTable' ),
-   $table
-   ) );
+   $this-dbUpdater-addExtensionUpdate( array( array( 
$this, 'fillUsageTable' ) ) );
}
}
 
/**
-* Static wrapper

[MediaWiki-commits] [Gerrit] Inject siteLinkGroups into ItemView - change (mediawiki...Wikibase)

2014-11-28 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Inject siteLinkGroups into ItemView
..


Inject siteLinkGroups into ItemView

Change-Id: Icd9af0daf0353245eeb73c225dd9121a762d5e98
---
M repo/includes/View/EntityView.php
M repo/includes/View/EntityViewFactory.php
M repo/includes/View/ItemView.php
M repo/includes/WikibaseRepo.php
M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php
5 files changed, 50 insertions(+), 8 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/includes/View/EntityView.php 
b/repo/includes/View/EntityView.php
index ee53a3b..59731f1 100644
--- a/repo/includes/View/EntityView.php
+++ b/repo/includes/View/EntityView.php
@@ -45,6 +45,11 @@
 */
protected $textInjector;
 
+   /**
+* @param FingerprintView $fingerprintView
+* @param ClaimsView $claimsView
+* @param Language $language
+*/
public function __construct(
FingerprintView $fingerprintView,
ClaimsView $claimsView,
diff --git a/repo/includes/View/EntityViewFactory.php 
b/repo/includes/View/EntityViewFactory.php
index 0a942b4..66e76f6 100644
--- a/repo/includes/View/EntityViewFactory.php
+++ b/repo/includes/View/EntityViewFactory.php
@@ -42,15 +42,22 @@
 */
private $sectionEditLinkGenerator;
 
+   /**
+* @var string[]
+*/
+   private $siteLinkGroups;
+
public function __construct(
EntityTitleLookup $entityTitleLookup,
EntityLookup $entityLookup,
-   OutputFormatSnakFormatterFactory $snakFormatterFactory
+   OutputFormatSnakFormatterFactory $snakFormatterFactory,
+   array $siteLinkGroups
) {
$this-entityTitleLookup = $entityTitleLookup;
$this-entityLookup = $entityLookup;
$this-snakFormatterFactory = $snakFormatterFactory;
$this-sectionEditLinkGenerator = new 
SectionEditLinkGenerator();
+   $this-siteLinkGroups = $siteLinkGroups;
}
 
/**
@@ -78,7 +85,7 @@
 
// @fixme support more entity types
if ( $entityType === 'item' ) {
-   return new ItemView( $fingerprintView, $claimsView, 
$language );
+   return new ItemView( $fingerprintView, $claimsView, 
$language, $this-siteLinkGroups );
} elseif ( $entityType === 'property' ) {
$displayStatementsOnProperties = 
WikibaseRepo::getDefaultInstance()-getSettings()
-getSetting( 
'displayStatementsOnProperties' );
diff --git a/repo/includes/View/ItemView.php b/repo/includes/View/ItemView.php
index 16fd88e..4c2f152 100644
--- a/repo/includes/View/ItemView.php
+++ b/repo/includes/View/ItemView.php
@@ -3,6 +3,7 @@
 namespace Wikibase\Repo\View;
 
 use InvalidArgumentException;
+use Language;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\EntityRevision;
 use Wikibase\Repo\WikibaseRepo;
@@ -18,6 +19,30 @@
  * @author Daniel Werner
  */
 class ItemView extends EntityView {
+
+   /**
+* @var string[]
+*/
+   private $siteLinkGroups;
+
+   /**
+* @see EntityView::__construct
+*
+* @param FingerprintView $fingerprintView
+* @param ClaimsView $claimsView
+* @param Language $language
+* @param string[] $siteLinkGroups
+*/
+   public function __construct(
+   FingerprintView $fingerprintView,
+   ClaimsView $claimsView,
+   Language $language,
+   array $siteLinkGroups
+   ) {
+   parent::__construct( $fingerprintView, $claimsView, $language );
+
+   $this-siteLinkGroups = $siteLinkGroups;
+   }
 
/**
 * @see EntityView::getMainHtml
@@ -54,8 +79,7 @@
protected function getTocSections() {
$array = parent::getTocSections();
$array['claims'] = 'wikibase-statements';
-   $groups = 
WikibaseRepo::getDefaultInstance()-getSettings()-getSetting( 'siteLinkGroups' 
);
-   foreach ( $groups as $group ) {
+   foreach ( $this-siteLinkGroups as $group ) {
$id = htmlspecialchars( 'sitelinks-' . $group, 
ENT_QUOTES );
$array[$id] = 'wikibase-sitelinks-' . $group;
}
@@ -74,7 +98,6 @@
 */
protected function getHtmlForSiteLinks( Item $item, $editable = true ) {
$wikibaseRepo = WikibaseRepo::getDefaultInstance();
-   $groups = $wikibaseRepo-getSettings()-getSetting( 
'siteLinkGroups' );
 
// FIXME: Inject this
$siteLinksView = new SiteLinksView(
@@ -86,7 +109,12 @@
 
$itemId = $item-getId

[MediaWiki-commits] [Gerrit] Rewrite completely broken EntityView tests - change (mediawiki...Wikibase)

2014-11-28 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Rewrite completely broken EntityView tests
..


Rewrite completely broken EntityView tests

Change-Id: Ibc373a9017c25cc2bdacbabeea2b97d283e31b00
---
M repo/tests/phpunit/includes/View/EntityViewTest.php
M repo/tests/phpunit/includes/View/ItemViewTest.php
M repo/tests/phpunit/includes/View/PropertyViewTest.php
3 files changed, 88 insertions(+), 268 deletions(-)

Approvals:
  Hoo man: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/repo/tests/phpunit/includes/View/EntityViewTest.php 
b/repo/tests/phpunit/includes/View/EntityViewTest.php
index 3592b45..c689b99 100644
--- a/repo/tests/phpunit/includes/View/EntityViewTest.php
+++ b/repo/tests/phpunit/includes/View/EntityViewTest.php
@@ -2,35 +2,11 @@
 
 namespace Wikibase\Test;
 
-use IContextSource;
-use InvalidArgumentException;
-use Language;
-use RequestContext;
-use Title;
-use ValueFormatters\FormatterOptions;
-use Wikibase\DataModel\Claim\Claim;
-use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Entity\EntityIdValue;
-use Wikibase\DataModel\Entity\Item;
-use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\Entity\Property;
-use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Snak\PropertyValueSnak;
-use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\Statement;
 use Wikibase\EntityRevision;
-use Wikibase\LanguageFallbackChain;
-use Wikibase\Lib\Serializers\SerializationOptions;
-use Wikibase\Lib\SnakFormatter;
-use Wikibase\Lib\Store\EntityInfoBuilderFactory;
-use Wikibase\Lib\Store\EntityTitleLookup;
-use Wikibase\ParserOutputJsConfigBuilder;
-use Wikibase\ReferencedEntitiesFinder;
 use Wikibase\Repo\View\EntityView;
-use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Utils;
 
 /**
  * @covers Wikibase\Repo\View\EntityView
@@ -47,166 +23,6 @@
  * @author Daniel Kinzler
  */
 abstract class EntityViewTest extends \MediaWikiLangTestCase {
-
-   /**
-* @var MockRepository
-*/
-   private $mockRepository;
-
-   protected function newEntityIdParser() {
-   // The data provides use P123 and Q123 IDs, so the parser needs 
to understand these.
-   return new BasicEntityIdParser();
-   }
-
-   public function getTitleForId( EntityId $id ) {
-   $name = $id-getEntityType() . ':' . $id-getSerialization();
-   return Title::makeTitle( NS_MAIN, $name );
-   }
-
-   /**
-* @return EntityTitleLookup
-*/
-   protected function getEntityTitleLookupMock() {
-   $lookup = $this-getMock( 
'Wikibase\Lib\Store\EntityTitleLookup' );
-   $lookup-expects( $this-any() )
-   -method( 'getTitleForId' )
-   -will( $this-returnCallback( array( $this, 
'getTitleForId' ) ) );
-
-   return $lookup;
-   }
-
-   /**
-* @return SnakFormatter
-*/
-   protected function newSnakFormatterMock() {
-   $snakFormatter = $this-getMock( 'Wikibase\Lib\SnakFormatter' );
-
-   $snakFormatter-expects( $this-any() )-method( 'formatSnak' )
-   -will( $this-returnValue( '(value)' ) );
-
-   $snakFormatter-expects( $this-any() )-method( 'getFormat' )
-   -will( $this-returnValue( 
SnakFormatter::FORMAT_HTML_WIDGET ) );
-
-   $snakFormatter-expects( $this-any() )-method( 
'canFormatSnak' )
-   -will( $this-returnValue( true ) );
-
-   return $snakFormatter;
-   }
-
-   /**
-* @param string $entityType
-* @param EntityInfoBuilderFactory $entityInfoBuilderFactory
-* @param EntityTitleLookup $entityTitleLookup
-* @param IContextSource $context
-* @param LanguageFallbackChain $languageFallbackChain
-*
-* @throws InvalidArgumentException
-* @return EntityView
-*/
-   protected function newEntityView(
-   $entityType,
-   EntityInfoBuilderFactory $entityInfoBuilderFactory = null,
-   EntityTitleLookup $entityTitleLookup = null,
-   IContextSource $context = null,
-   LanguageFallbackChain $languageFallbackChain = null
-   ) {
-   if ( !is_string( $entityType ) ) {
-   throw new InvalidArgumentException( '$entityType must 
be a string!' );
-   }
-
-   $langCode = 'en';
-
-   if ( $context === null ) {
-   $context = new RequestContext();
-   $context-setLanguage( $langCode );
-   }
-
-   if ( $languageFallbackChain === null ) {
-   $factory = 
WikibaseRepo::getDefaultInstance

[MediaWiki-commits] [Gerrit] Clean up SiteLinkLookup and related - change (mediawiki...Wikibase)

2014-12-01 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176652

Change subject: Clean up SiteLinkLookup and related
..

Clean up SiteLinkLookup and related

I found this in my stashes. It's possible that I submitted this twice.
If you find an other patch that touches the same files then please
merge *this* first. I will rebase the other later.

Change-Id: Id0c53b3e9e61ae00cbc674b9f8dbc4f82a3017f6
---
M lib/includes/store/EntityInfoBuilderFactory.php
M lib/includes/store/GenericEntityInfoBuilder.php
M lib/includes/store/SiteLinkLookup.php
M lib/includes/store/sql/SiteLinkTable.php
M lib/includes/store/sql/SqlEntityInfoBuilderFactory.php
M lib/tests/phpunit/MockRepository.php
6 files changed, 242 insertions(+), 297 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/52/176652/1

diff --git a/lib/includes/store/EntityInfoBuilderFactory.php 
b/lib/includes/store/EntityInfoBuilderFactory.php
index 56b41b5..6ce254c 100644
--- a/lib/includes/store/EntityInfoBuilderFactory.php
+++ b/lib/includes/store/EntityInfoBuilderFactory.php
@@ -20,9 +20,10 @@
 * Returns a new EntityInfoBuilder for gathering information about the
 * Entities specified by the given IDs.
 *
-* @param EntityId[] $ids
+* @param EntityId[] $entityIds
 *
 * @return EntityInfoBuilder
 */
-   public function newEntityInfoBuilder( array $ids );
+   public function newEntityInfoBuilder( array $entityIds );
+
 }
diff --git a/lib/includes/store/GenericEntityInfoBuilder.php 
b/lib/includes/store/GenericEntityInfoBuilder.php
index 9c74b47..5a32b29 100644
--- a/lib/includes/store/GenericEntityInfoBuilder.php
+++ b/lib/includes/store/GenericEntityInfoBuilder.php
@@ -56,26 +56,29 @@
private $redirects = null;
 
/**
-* @param EntityId[] $ids
-* @param EntityIdParser $idParser
+* @param EntityId[] $entityIds
+* @param EntityIdParser $entityIdParser
 * @param EntityRevisionLookup $entityRevisionLookup
 */
-   public function __construct( array $ids, EntityIdParser $idParser, 
EntityRevisionLookup $entityRevisionLookup ) {
-   $this-idParser = $idParser;
+   public function __construct(
+   array $entityIds,
+   EntityIdParser $entityIdParser,
+   EntityRevisionLookup $entityRevisionLookup
+   ) {
+   $this-setEntityIds( $entityIds );
+   $this-idParser = $entityIdParser;
$this-entityRevisionLookup = $entityRevisionLookup;
-
-   $this-setEntityIds( $ids );
}
 
/**
-* @param EntityId[] $ids
+* @param EntityId[] $entityIds
 */
-   private function setEntityIds( $ids ) {
+   private function setEntityIds( array $entityIds ) {
$this-entityInfo = array();
 
-   foreach ( $ids as $id ) {
-   $key = $id-getSerialization();
-   $type = $id-getEntityType();
+   foreach ( $entityIds as $entityId ) {
+   $key = $entityId-getSerialization();
+   $type = $entityId-getEntityType();
 
$this-entityInfo[$key] = array(
'id' = $key,
diff --git a/lib/includes/store/SiteLinkLookup.php 
b/lib/includes/store/SiteLinkLookup.php
index 9af6623..1e4a42b 100644
--- a/lib/includes/store/SiteLinkLookup.php
+++ b/lib/includes/store/SiteLinkLookup.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Lib\Store;
 
+use DatabaseBase;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
@@ -21,22 +22,22 @@
 * currently in the store. The array is empty if there are no such 
conflicts.
 *
 * The items in the return array are arrays with the following elements:
-* - integer itemId
+* - int itemId Numeric (unprefixed) item id
 * - string siteId
 * - string sitePage
 *
 * @since 0.1
 *
 * @param Item  $item
-* @param \DatabaseBase|null $db The database object to use (optional).
+* @param DatabaseBase|null $db The database object to use (optional).
 *If conflict checking is performed as part of a save operation,
 *this should be used to provide the master DB connection that 
will
 *also be used for saving. This will preserve transactional 
integrity
 *and avoid race conditions.
 *
-* @return array of array
+* @return array[]
 */
-   public function getConflictsForItem( Item $item, \DatabaseBase $db = 
null );
+   public function getConflictsForItem( Item $item, DatabaseBase $db = 
null );
 
/**
 * Returns the id

[MediaWiki-commits] [Gerrit] Move all Hooks to Hooks folder and namespace - change (mediawiki...Wikibase)

2014-12-01 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176655

Change subject: Move all Hooks to Hooks folder and namespace
..

Move all Hooks to Hooks folder and namespace

Change-Id: Icdc745fcfc5e8eefe9c9ea9506f6346f9664250b
---
R client/includes/Hooks/BaseTemplateAfterPortletHandler.php
R client/includes/Hooks/BeforePageDisplayHandler.php
R client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
R client/includes/Hooks/DataUpdateHookHandlers.php
R client/includes/Hooks/DeletePageNoticeCreator.php
R client/includes/Hooks/InfoActionHookHandler.php
R client/includes/Hooks/LanguageLinkBadgeDisplay.php
R client/includes/Hooks/MovePageNotice.php
R client/includes/Hooks/OtherProjectsSidebarGenerator.php
R client/includes/Hooks/ParserFunctionRegistrant.php
R client/includes/Hooks/SidebarHookHandlers.php
R client/includes/Hooks/SpecialWatchlistQueryHandler.php
M client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
M client/tests/phpunit/includes/hooks/DeletePageNoticeCreatorTest.php
M client/tests/phpunit/includes/hooks/MovePageNoticeTest.php
M repo/Wikibase.php
A repo/includes/Hooks/LinkBeginHookHandler.php
R repo/includes/Hooks/OutputPageJsConfigHookHandler.php
M repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
M repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php
20 files changed, 247 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/55/176655/1

diff --git a/client/includes/hooks/BaseTemplateAfterPortletHandler.php 
b/client/includes/Hooks/BaseTemplateAfterPortletHandler.php
similarity index 100%
rename from client/includes/hooks/BaseTemplateAfterPortletHandler.php
rename to client/includes/Hooks/BaseTemplateAfterPortletHandler.php
diff --git a/client/includes/hooks/BeforePageDisplayHandler.php 
b/client/includes/Hooks/BeforePageDisplayHandler.php
similarity index 100%
rename from client/includes/hooks/BeforePageDisplayHandler.php
rename to client/includes/Hooks/BeforePageDisplayHandler.php
diff --git a/client/includes/hooks/ChangesPageWikibaseFilterHandler.php 
b/client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
similarity index 100%
rename from client/includes/hooks/ChangesPageWikibaseFilterHandler.php
rename to client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
diff --git a/client/includes/hooks/DataUpdateHookHandlers.php 
b/client/includes/Hooks/DataUpdateHookHandlers.php
similarity index 100%
rename from client/includes/hooks/DataUpdateHookHandlers.php
rename to client/includes/Hooks/DataUpdateHookHandlers.php
diff --git a/client/includes/hooks/DeletePageNoticeCreator.php 
b/client/includes/Hooks/DeletePageNoticeCreator.php
similarity index 96%
rename from client/includes/hooks/DeletePageNoticeCreator.php
rename to client/includes/Hooks/DeletePageNoticeCreator.php
index f1c4cb6..04af59f 100644
--- a/client/includes/hooks/DeletePageNoticeCreator.php
+++ b/client/includes/Hooks/DeletePageNoticeCreator.php
@@ -1,9 +1,10 @@
 ?php
 
-namespace Wikibase\Client;
+namespace Wikibase\Client\Hooks;
 
 use Html;
 use Title;
+use Wikibase\Client\RepoLinker;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\Lib\Store\SiteLinkLookup;
 
diff --git a/client/includes/hooks/InfoActionHookHandler.php 
b/client/includes/Hooks/InfoActionHookHandler.php
similarity index 100%
rename from client/includes/hooks/InfoActionHookHandler.php
rename to client/includes/Hooks/InfoActionHookHandler.php
diff --git a/client/includes/hooks/LanguageLinkBadgeDisplay.php 
b/client/includes/Hooks/LanguageLinkBadgeDisplay.php
similarity index 100%
rename from client/includes/hooks/LanguageLinkBadgeDisplay.php
rename to client/includes/Hooks/LanguageLinkBadgeDisplay.php
diff --git a/client/includes/hooks/MovePageNotice.php 
b/client/includes/Hooks/MovePageNotice.php
similarity index 96%
rename from client/includes/hooks/MovePageNotice.php
rename to client/includes/Hooks/MovePageNotice.php
index 1c0de37..004866c 100644
--- a/client/includes/hooks/MovePageNotice.php
+++ b/client/includes/Hooks/MovePageNotice.php
@@ -1,9 +1,10 @@
 ?php
 
-namespace Wikibase\Client;
+namespace Wikibase\Client\Hooks;
 
 use Html;
 use Title;
+use Wikibase\Client\RepoLinker;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\Lib\Store\SiteLinkLookup;
 
diff --git a/client/includes/hooks/OtherProjectsSidebarGenerator.php 
b/client/includes/Hooks/OtherProjectsSidebarGenerator.php
similarity index 100%
rename from client/includes/hooks/OtherProjectsSidebarGenerator.php
rename to client/includes/Hooks/OtherProjectsSidebarGenerator.php
diff --git a/client/includes/hooks/ParserFunctionRegistrant.php 
b/client/includes/Hooks/ParserFunctionRegistrant.php
similarity index 100%
rename from client/includes/hooks/ParserFunctionRegistrant.php
rename to client/includes/Hooks/ParserFunctionRegistrant.php
diff --git a/client/includes/hooks

[MediaWiki-commits] [Gerrit] Move client Hooks classes to Hooks folder/namespace - change (mediawiki...Wikibase)

2014-12-01 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176660

Change subject: Move client Hooks classes to Hooks folder/namespace
..

Move client Hooks classes to Hooks folder/namespace

Change-Id: If4662170bf8c644d27a32c522d30bd62258eb9a2
---
M client/WikibaseClient.hooks.php
R client/includes/Hooks/BaseTemplateAfterPortletHandler.php
R client/includes/Hooks/BeforePageDisplayHandler.php
R client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
R client/includes/Hooks/DataUpdateHookHandlers.php
R client/includes/Hooks/DeletePageNoticeCreator.php
R client/includes/Hooks/InfoActionHookHandler.php
R client/includes/Hooks/LanguageLinkBadgeDisplay.php
R client/includes/Hooks/MovePageNoticeCreator.php
R client/includes/Hooks/OtherProjectsSidebarGenerator.php
R client/includes/Hooks/OtherProjectsSidebarGeneratorFactory.php
R client/includes/Hooks/ParserAfterParseHookHandler.php
R client/includes/Hooks/ParserFunctionRegistrant.php
R client/includes/Hooks/SidebarHookHandlers.php
R client/includes/Hooks/SpecialWatchlistQueryHandler.php
R client/includes/Hooks/UpdateRepoHookHandlers.php
M client/tests/phpunit/includes/hooks/DeletePageNoticeCreatorTest.php
M client/tests/phpunit/includes/hooks/MovePageNoticeCreatorTest.php
18 files changed, 10 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/60/176660/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 5cc19e5..c6c1fcd 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -5,7 +5,6 @@
 use Action;
 use BaseTemplate;
 use ChangesList;
-use Content;
 use FormOptions;
 use IContextSource;
 use Message;
@@ -24,23 +23,20 @@
 use UnexpectedValueException;
 use User;
 use Wikibase\Client\Changes\ChangeHandler;
-use Wikibase\Client\DeletePageNoticeCreator;
 use Wikibase\Client\Hooks\BaseTemplateAfterPortletHandler;
 use Wikibase\Client\Hooks\BeforePageDisplayHandler;
 use Wikibase\Client\Hooks\ChangesPageWikibaseFilterHandler;
+use Wikibase\Client\Hooks\DeletePageNoticeCreator;
 use Wikibase\Client\Hooks\InfoActionHookHandler;
+use Wikibase\Client\Hooks\MovePageNoticeCreator;
 use Wikibase\Client\Hooks\SpecialWatchlistQueryHandler;
-use Wikibase\Client\MovePageNoticeCreator;
 use Wikibase\Client\RecentChanges\ChangeLineFormatter;
 use Wikibase\Client\RecentChanges\ExternalChangeFactory;
 use Wikibase\Client\RecentChanges\RecentChangesFilterOptions;
 use Wikibase\Client\RepoItemLinkGenerator;
-use Wikibase\Client\UpdateRepo\UpdateRepoOnDelete;
-use Wikibase\Client\UpdateRepo\UpdateRepoOnMove;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\SiteLink;
-use WikiPage;
 
 /**
  * File defining the hook handlers for the Wikibase Client extension.
diff --git a/client/includes/hooks/BaseTemplateAfterPortletHandler.php 
b/client/includes/Hooks/BaseTemplateAfterPortletHandler.php
similarity index 100%
rename from client/includes/hooks/BaseTemplateAfterPortletHandler.php
rename to client/includes/Hooks/BaseTemplateAfterPortletHandler.php
diff --git a/client/includes/hooks/BeforePageDisplayHandler.php 
b/client/includes/Hooks/BeforePageDisplayHandler.php
similarity index 100%
rename from client/includes/hooks/BeforePageDisplayHandler.php
rename to client/includes/Hooks/BeforePageDisplayHandler.php
diff --git a/client/includes/hooks/ChangesPageWikibaseFilterHandler.php 
b/client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
similarity index 100%
rename from client/includes/hooks/ChangesPageWikibaseFilterHandler.php
rename to client/includes/Hooks/ChangesPageWikibaseFilterHandler.php
diff --git a/client/includes/hooks/DataUpdateHookHandlers.php 
b/client/includes/Hooks/DataUpdateHookHandlers.php
similarity index 100%
rename from client/includes/hooks/DataUpdateHookHandlers.php
rename to client/includes/Hooks/DataUpdateHookHandlers.php
diff --git a/client/includes/hooks/DeletePageNoticeCreator.php 
b/client/includes/Hooks/DeletePageNoticeCreator.php
similarity index 96%
rename from client/includes/hooks/DeletePageNoticeCreator.php
rename to client/includes/Hooks/DeletePageNoticeCreator.php
index f1c4cb6..04af59f 100644
--- a/client/includes/hooks/DeletePageNoticeCreator.php
+++ b/client/includes/Hooks/DeletePageNoticeCreator.php
@@ -1,9 +1,10 @@
 ?php
 
-namespace Wikibase\Client;
+namespace Wikibase\Client\Hooks;
 
 use Html;
 use Title;
+use Wikibase\Client\RepoLinker;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\Lib\Store\SiteLinkLookup;
 
diff --git a/client/includes/hooks/InfoActionHookHandler.php 
b/client/includes/Hooks/InfoActionHookHandler.php
similarity index 100%
rename from client/includes/hooks/InfoActionHookHandler.php
rename to client/includes/Hooks/InfoActionHookHandler.php
diff --git a/client/includes/hooks/LanguageLinkBadgeDisplay.php 
b/client/includes/Hooks

[MediaWiki-commits] [Gerrit] Move Repo Hooks classes to Hooks folder/namespace - change (mediawiki...Wikibase)

2014-12-01 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176661

Change subject: Move Repo Hooks classes to Hooks folder/namespace
..

Move Repo Hooks classes to Hooks folder/namespace

Change-Id: If9295f0996ac2aa791de4169b97d76e2d5e0923a
---
M repo/Wikibase.hooks.php
M repo/Wikibase.php
R repo/includes/Hooks/LinkBeginHookHandler.php
R repo/includes/Hooks/OutputPageJsConfigHookHandler.php
R repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
R repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
6 files changed, 11 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/61/176661/1

diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index 33a63fe..d8f480c 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -28,8 +28,8 @@
 use User;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdParsingException;
-use Wikibase\Hook\OutputPageJsConfigHookHandler;
 use Wikibase\Repo\Content\EntityHandler;
+use Wikibase\Repo\Hooks\OutputPageJsConfigHookHandler;
 use Wikibase\Repo\View\EntityViewPlaceholderExpander;
 use Wikibase\Repo\View\TextInjector;
 use Wikibase\Repo\WikibaseRepo;
diff --git a/repo/Wikibase.php b/repo/Wikibase.php
index a5fdfaf..b6e9bad 100644
--- a/repo/Wikibase.php
+++ b/repo/Wikibase.php
@@ -195,7 +195,7 @@
$wgHooks['ArticleDeleteComplete'][] = 
'Wikibase\RepoHooks::onArticleDeleteComplete';
$wgHooks['ArticleUndelete'][]   
= 'Wikibase\RepoHooks::onArticleUndelete';
$wgHooks['GetPreferences'][]
= 'Wikibase\RepoHooks::onGetPreferences';
-   $wgHooks['LinkBegin'][] 
= 'Wikibase\Repo\Hook\LinkBeginHookHandler::onLinkBegin';
+   $wgHooks['LinkBegin'][] 
= 'Wikibase\Repo\Hooks\LinkBeginHookHandler::onLinkBegin';
$wgHooks['OutputPageBodyAttributes'][]  = 
'Wikibase\RepoHooks::onOutputPageBodyAttributes';
//FIXME: handle other types of entities with autocomments too!
$wgHooks['FormatAutocomments'][]
= array( 'Wikibase\RepoHooks::onFormat', array( CONTENT_MODEL_WIKIBASE_ITEM, 
wikibase-item ) );
diff --git a/repo/includes/Hook/LinkBeginHookHandler.php 
b/repo/includes/Hooks/LinkBeginHookHandler.php
similarity index 99%
rename from repo/includes/Hook/LinkBeginHookHandler.php
rename to repo/includes/Hooks/LinkBeginHookHandler.php
index 39160a5..0227115 100644
--- a/repo/includes/Hook/LinkBeginHookHandler.php
+++ b/repo/includes/Hooks/LinkBeginHookHandler.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Repo\Hook;
+namespace Wikibase\Repo\Hooks;
 
 use DummyLinker;
 use Html;
diff --git a/repo/includes/Hook/OutputPageJsConfigHookHandler.php 
b/repo/includes/Hooks/OutputPageJsConfigHookHandler.php
similarity index 97%
rename from repo/includes/Hook/OutputPageJsConfigHookHandler.php
rename to repo/includes/Hooks/OutputPageJsConfigHookHandler.php
index e242766..34a8f7b 100644
--- a/repo/includes/Hook/OutputPageJsConfigHookHandler.php
+++ b/repo/includes/Hooks/OutputPageJsConfigHookHandler.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Hook;
+namespace Wikibase\Repo\Hooks;
 
 use OutputPage;
 use Wikibase\OutputPageJsConfigBuilder;
diff --git a/repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php 
b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
similarity index 97%
rename from repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
rename to repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
index 0d48d8b..ab84107 100644
--- a/repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
+++ b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Repo\Tests\Hooks;
 
 use Language;
 use RequestContext;
@@ -8,11 +8,11 @@
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Lib\Store\EntityTitleLookup;
-use Wikibase\Repo\Hook\LinkBeginHookHandler;
+use Wikibase\Repo\Hooks\LinkBeginHookHandler;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
- * @covers Wikibase\Repo\Hook\LinkBeginHookHandler
+ * @covers Wikibase\Repo\Hooks\LinkBeginHookHandler
  *
  * @since 0.5
  *
@@ -185,4 +185,5 @@
);
 
}
+
 }
diff --git 
a/repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php 
b/repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
similarity index 92%
rename from 
repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php
rename to 
repo/tests/phpunit/includes/Hooks/OutputPageJsConfigHookHandlerTest.php
index dbec07c

[MediaWiki-commits] [Gerrit] Narrow RdfBuilder interfaces as much as possible - change (mediawiki...Wikibase)

2014-12-01 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176725

Change subject: Narrow RdfBuilder interfaces as much as possible
..

Narrow RdfBuilder interfaces as much as possible

... and make as much stuff as possible private. Please note that
the code is not unused, see //$this-addStatements( ...

Change-Id: I88c0f62ab4b13e65aa79995236bfa344a76348e6
---
M repo/includes/rdf/RdfBuilder.php
M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
2 files changed, 61 insertions(+), 62 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/25/176725/1

diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php
index 8c30ab2..b817e02 100644
--- a/repo/includes/rdf/RdfBuilder.php
+++ b/repo/includes/rdf/RdfBuilder.php
@@ -16,6 +16,7 @@
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\Statement;
 use Wikibase\DataModel\StatementListProvider;
 use Wikibase\Lib\Store\EntityLookup;
 
@@ -60,7 +61,7 @@
 *
 * @var array
 */
-   protected $namespaces = array();
+   private $namespaces = array();
 
/**
 * A list of entities mentioned/touched to or by this builder.
@@ -70,7 +71,7 @@
 *
 * @var array
 */
-   protected $entitiesResolved = array();
+   private $entitiesResolved = array();
 
/**
 * @param SiteList $sites
@@ -138,24 +139,24 @@
 * refer to the Wikibase RDF mapping spec.
 *
 * @param string   $prefix use a self::NS_XXX constant
-* @param EntityId $id
+* @param EntityId $entityId
 *
 * @return string
 */
-   public function getEntityQName( $prefix, EntityId $id ) {
-   return $prefix . ':' . ucfirst( $id-getSerialization() );
+   public function getEntityQName( $prefix, EntityId $entityId ) {
+   return $prefix . ':' . ucfirst( $entityId-getSerialization() );
}
 
/**
 * Returns a qname for the given statement using the given prefix.
 *
 * @param string $prefix use a self::NS_XXX constant, usually 
self::NS_STATEMENT
-* @param Claim $claim
+* @param Statement $statement
 *
 * @return string
 */
-   public function getStatementQName( $prefix, Claim $claim ) {
-   return $prefix . ':' . $claim-getGuid();
+   private function getStatementQName( $prefix, Statement $statement ) {
+   return $prefix . ':' . $statement-getGuid();
}
 
/**
@@ -166,7 +167,7 @@
 *
 * @return string
 */
-   public function getEntityTypeQName( $type ) {
+   private function getEntityTypeQName( $type ) {
//TODO: the list of types is configurable, need to register 
URIs for extra types!
 
return self::NS_ONTOLOGY . ':' . ucfirst( $type );
@@ -175,12 +176,12 @@
/**
 * Gets a resource object representing the given entity
 *
-* @param EntityId $id
+* @param EntityId $entityId
 *
 * @return EasyRDF_Resource
 */
-   public function getEntityResource( EntityId $id ) {
-   $entityQName = $this-getEntityQName( self::NS_ENTITY, $id );
+   private function getEntityResource( EntityId $entityId ) {
+   $entityQName = $this-getEntityQName( self::NS_ENTITY, 
$entityId );
$entityResource = $this-graph-resource( $entityQName );
return $entityResource;
}
@@ -188,14 +189,12 @@
/**
 * Gets a URL of the rdf description of the given entity
 *
-* @param EntityId $id
+* @param EntityId $entityId
 *
 * @return string
 */
-   public function getDataURL( EntityId $id ) {
-   $base = $this-namespaces[ self::NS_DATA ];
-   $url = $base . ucfirst( $id-getSerialization() );
-   return $url;
+   public function getDataURL( EntityId $entityId ) {
+   return $this-namespaces[self::NS_DATA] . ucfirst( 
$entityId-getSerialization() );
}
 
/**
@@ -205,7 +204,7 @@
 *
 * @return bool
 */
-   protected function isLanguageIncluded( $lang ) {
+   private function isLanguageIncluded( $lang ) {
return true; //todo: optional filter
}
 
@@ -213,10 +212,10 @@
 * Registers an entity as mentioned. Will be recorded as unresolved
 * if it wasn't already marked as resolved.
 *
-* @param EntityId $id
+* @param EntityId $entityId
 */
-   protected function entityMentioned( EntityId $id ) {
-   $prefixedId = $id-getSerialization();
+   private function

[MediaWiki-commits] [Gerrit] Remove unused imports from Client - change (mediawiki...Wikibase)

2014-12-02 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176903

Change subject: Remove unused imports from Client
..

Remove unused imports from Client

Some are not reported by PHPStorm, I found them with a regex.

Change-Id: I6cd2db1d31ace633568573f66caafa0a30aefe84
---
M client/WikibaseClient.hooks.php
M client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
M client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
M client/includes/hooks/ParserAfterParseHookHandler.php
M client/includes/hooks/SidebarHookHandlers.php
M client/includes/hooks/UpdateRepoHookHandlers.php
M client/includes/scribunto/WikibaseLuaEntityBindings.php
M client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
M client/tests/phpunit/includes/Usage/Sql/UsageTableUpdaterTest.php
M client/tests/phpunit/includes/Usage/UsageTrackerContractTester.php
M client/tests/phpunit/includes/UsageUpdaterTest.php
M client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
M client/tests/phpunit/includes/store/TitleFactoryTest.php
14 files changed, 0 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/03/176903/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index 5cc19e5..ad9078e 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -5,7 +5,6 @@
 use Action;
 use BaseTemplate;
 use ChangesList;
-use Content;
 use FormOptions;
 use IContextSource;
 use Message;
@@ -35,12 +34,9 @@
 use Wikibase\Client\RecentChanges\ExternalChangeFactory;
 use Wikibase\Client\RecentChanges\RecentChangesFilterOptions;
 use Wikibase\Client\RepoItemLinkGenerator;
-use Wikibase\Client\UpdateRepo\UpdateRepoOnDelete;
-use Wikibase\Client\UpdateRepo\UpdateRepoOnMove;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\SiteLink;
-use WikiPage;
 
 /**
  * File defining the hook handlers for the Wikibase Client extension.
diff --git a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php 
b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
index c318089..e893a62 100644
--- a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
+++ b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
@@ -6,8 +6,6 @@
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Snak\Snak;
-use Wikibase\DataModel\Statement\BestStatementsFinder;
-use Wikibase\DataModel\Statement\Statement;
 use Wikibase\DataModel\StatementListProvider;
 use Wikibase\Lib\Store\EntityLookup;
 
diff --git a/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php 
b/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
index d2eca0f..e344065 100644
--- a/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
+++ b/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
@@ -4,7 +4,6 @@
 
 use DatabaseUpdater;
 use Wikibase\Client\WikibaseClient;
-use Wikibase\DataModel\Entity\EntityIdParser;
 
 /**
  * Schema updater for SqlUsageTracker
diff --git a/client/includes/hooks/ParserAfterParseHookHandler.php 
b/client/includes/hooks/ParserAfterParseHookHandler.php
index 81ad94e..c27bc49 100644
--- a/client/includes/hooks/ParserAfterParseHookHandler.php
+++ b/client/includes/hooks/ParserAfterParseHookHandler.php
@@ -10,8 +10,6 @@
 use Wikibase\InterwikiSorter;
 use Wikibase\LangLinkHandler;
 use Wikibase\NamespaceChecker;
-use Wikibase\NoLangLinkHandler;
-use Wikibase\SettingsArray;
 
 /**
  * @since 0.5.
diff --git a/client/includes/hooks/SidebarHookHandlers.php 
b/client/includes/hooks/SidebarHookHandlers.php
index a703555..4e7910e 100644
--- a/client/includes/hooks/SidebarHookHandlers.php
+++ b/client/includes/hooks/SidebarHookHandlers.php
@@ -10,7 +10,6 @@
 use Wikibase\Client\WikibaseClient;
 use Wikibase\NamespaceChecker;
 use Wikibase\NoLangLinkHandler;
-use Wikibase\SettingsArray;
 
 /**
  * ParserOutput related hook handlers.
diff --git a/client/includes/hooks/UpdateRepoHookHandlers.php 
b/client/includes/hooks/UpdateRepoHookHandlers.php
index a1b2180..45566a2 100644
--- a/client/includes/hooks/UpdateRepoHookHandlers.php
+++ b/client/includes/hooks/UpdateRepoHookHandlers.php
@@ -10,7 +10,6 @@
 use ManualLogEntry;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\NamespaceChecker;
-use Wikibase\SettingsArray;
 use Wikibase\Lib\Store\SiteLinkLookup;
 use Wikibase\Client\UpdateRepo\UpdateRepo;
 use Wikibase\Client\UpdateRepo\UpdateRepoOnDelete;
diff --git a/client/includes/scribunto/WikibaseLuaEntityBindings.php 
b/client/includes/scribunto/WikibaseLuaEntityBindings.php
index d0e343d..e908c16 100644
--- a/client/includes/scribunto/WikibaseLuaEntityBindings.php
+++ b/client/includes/scribunto/WikibaseLuaEntityBindings.php
@@ -12,7

[MediaWiki-commits] [Gerrit] Make EntityPerPageBuilderTest fields/methods private - change (mediawiki...Wikibase)

2014-12-02 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176913

Change subject: Make EntityPerPageBuilderTest fields/methods private
..

Make EntityPerPageBuilderTest fields/methods private

This is split from I04767f2 to make it easier to review.

Change-Id: I752c3e3b9c7c7417ec4d0fc4e19e3235def7c20f
---
M repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
1 file changed, 25 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/13/176913/1

diff --git a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php 
b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
index 183e516..e93b408 100644
--- a/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
+++ b/repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
@@ -30,17 +30,17 @@
/**
 * @var EntityPerPage
 */
-   protected $entityPerPageTable;
+   private $entityPerPageTable;
 
/**
 * @var array[]
 */
-   protected $entityPerPageRows;
+   private $entityPerPageRows;
 
/**
 * @var WikibaseRepo
 */
-   protected $wikibaseRepo;
+   private $wikibaseRepo;
 
protected function setUp() {
parent::setUp();
@@ -61,7 +61,7 @@
/**
 * @return User
 */
-   protected function getUser() {
+   private function getUser() {
$user = User::newFromName( 'zombie1' );
 
if ( $user-getId() === 0 ) {
@@ -71,7 +71,7 @@
return $user;
}
 
-   protected function clearTables() {
+   private function clearTables() {
$dbw = wfGetDB( DB_MASTER );
 
$dbw-delete( 'page', array( 1 ) );
@@ -82,12 +82,18 @@
}
}
 
+   /**
+* @return bool
+*/
private function itemSupportsRedirect() {
$handler = ContentHandler::getForModelID( 
CONTENT_MODEL_WIKIBASE_ITEM );
return $handler-supportsRedirects();
}
 
-   protected function addItems() {
+   /**
+* @return Item[]
+*/
+   private function addItems() {
$user = $this-getUser();
 
$labels = array( 'New York City', 'Tokyo', 'Jakarta', 'Nairobi',
@@ -125,16 +131,19 @@
return $items;
}
 
-   protected function partialClearEntityPerPageTable( $pageId ) {
+   /**
+* @param int $pageId
+*/
+   private function partialClearEntityPerPageTable( $pageId ) {
$dbw = wfGetDB( DB_MASTER );
$dbw-delete( 'wb_entity_per_page', array( 'epp_page_id  ' . 
$pageId ) );
}
 
/**
-* @return int
 * @throws RuntimeException
+* @return int
 */
-   protected function getPageIdForPartialClear() {
+   private function getPageIdForPartialClear() {
$dbw = wfGetDB( DB_MASTER );
$pageRow = $dbw-select(
'page',
@@ -158,7 +167,7 @@
/**
 * @return int
 */
-   protected function countPages() {
+   private function countPages() {
$dbw = wfGetDB( DB_MASTER );
$pages = $dbw-select( 'page', array( 'page_id' ), array(), 
__METHOD__ );
 
@@ -168,7 +177,7 @@
/**
 * @return int
 */
-   protected function countEntityPerPageRows() {
+   private function countEntityPerPageRows() {
$dbw = wfGetDB( DB_MASTER );
$eppRows = $dbw-selectField( 'wb_entity_per_page', 'count(*)', 
array(), __METHOD__ );
 
@@ -176,9 +185,9 @@
}
 
/**
-* @return array
+* @return array[]
 */
-   protected function getEntityPerPageData() {
+   private function getEntityPerPageData() {
$dbw = wfGetDB( DB_MASTER );
$rows = $dbw-select(
'wb_entity_per_page',
@@ -235,6 +244,9 @@
$this-assertRows( $this-entityPerPageRows );
}
 
+   /**
+* @param array[] $expectedRows
+*/
private function assertRows( $expectedRows ) {
$dbw = wfGetDB( DB_MASTER );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/176913
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I752c3e3b9c7c7417ec4d0fc4e19e3235def7c20f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid getDefaultInstance method name in tests - change (mediawiki...Wikibase)

2014-12-02 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176915

Change subject: Avoid getDefaultInstance method name in tests
..

Avoid getDefaultInstance method name in tests

This is split from I04767f2 to make it easier to review.

Change-Id: I712432649c38e5e8cc3148e5c12001b1cf33c6ed
---
M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
M repo/tests/phpunit/includes/WikibaseRepoTest.php
4 files changed, 102 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/15/176915/1

diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php 
b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
index b8dbc26..1a4ef8d 100644
--- a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
+++ b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
@@ -20,14 +20,14 @@
  */
 class PropertyIdResolverTest extends \PHPUnit_Framework_TestCase {
 
-   private function getDefaultInstance() {
-   $repo = $this-newMockRepository();
-   $propertyLabelResolver = new MockPropertyLabelResolver( 'en', 
$repo );
+   private function getPropertyIdResolver() {
+   $mockRepository = $this-getMockRepository();
+   $propertyLabelResolver = new MockPropertyLabelResolver( 'en', 
$mockRepository );
 
return new PropertyIdResolver( $propertyLabelResolver );
}
 
-   private function newMockRepository() {
+   private function getMockRepository() {
$propertyId = new PropertyId( 'P1337' );
 
$property = Property::newFromType( 'string' );
@@ -43,8 +43,8 @@
/**
 * @dataProvider resolvePropertyIdProvider
 */
-   public function testResolvePropertyId( $expected, $propertyLabelOrId ) {
-   $propertyIdResolver = $this-getDefaultInstance();
+   public function testResolvePropertyId( PropertyId $expected, 
$propertyLabelOrId ) {
+   $propertyIdResolver = $this-getPropertyIdResolver();
 
$propertyId = $propertyIdResolver-resolvePropertyId( 
$propertyLabelOrId, 'en' );
$this-assertEquals( $expected, $propertyId );
@@ -63,7 +63,7 @@
 * @dataProvider 
resolvePropertyIdWithInvalidInput_throwsExceptionProvider
 */
public function testResolvePropertyIdWithInvalidInput_throwsException( 
$propertyIdOrLabel ) {
-   $propertyIdResolver = $this-getDefaultInstance();
+   $propertyIdResolver = $this-getPropertyIdResolver();
 
$this-setExpectedException( 
'Wikibase\Lib\PropertyLabelNotResolvedException' );
 
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
index 65ddf59..108a822 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
@@ -11,6 +11,7 @@
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
 use Wikibase\DataModel\Statement\Statement;
+use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Test\MockRepository;
 
 /**
@@ -26,16 +27,19 @@
  */
 class SnaksFinderTest extends \PHPUnit_Framework_TestCase {
 
-   private function getDefaultInstance() {
-   $repo = $this-newMockRepository();
+   private function getSnaksFinder() {
+   $entityLookup = $this-getEntityLookup();
 
-   return new SnaksFinder( $repo );
+   return new SnaksFinder( $entityLookup );
}
 
-   private function newMockRepository() {
+   /**
+* @return EntityLookup
+*/
+   private function getEntityLookup() {
$propertyId = new PropertyId( 'P1337' );
 
-   $entityLookup = new MockRepository();
+   $mockRepository = new MockRepository();
 
$statement1 = new Statement( new Claim( new PropertyValueSnak(
$propertyId,
@@ -67,19 +71,19 @@
$property-setId( $propertyId );
$property-getFingerprint()-setLabel( 'en', 'a kitten!' );
 
-   $entityLookup-putEntity( $item );
-   $entityLookup-putEntity( $property );
+   $mockRepository-putEntity( $item );
+   $mockRepository-putEntity( $property );
 
-   return $entityLookup;
+   return $mockRepository;
}
 
/**
 * @dataProvider findSnaksProvider
 */
-   public function testFindSnaks( $expected

[MediaWiki-commits] [Gerrit] Remove repeated var name from @var doc tags - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177193

Change subject: Remove repeated var name from @var doc tags
..

Remove repeated var name from @var doc tags

This is a copy  paste error. The var name must be repeated if the
@var doc tag is used inline, but not for class properties.

This also fixes some closely related mistakes in doc tags.

Change-Id: I72b8ac68f2b68a2ed2a2bf5fdfd72ab1ae2506c4
---
M client/includes/Changes/ChangeHandler.php
M client/includes/store/UsageUpdater.php
M client/includes/store/sql/DirectSqlStore.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M lib/includes/ChangeNotificationJob.php
M lib/includes/changes/EntityChange.php
M lib/includes/serializers/SiteLinkSerializer.php
M lib/includes/store/CachingEntityRevisionLookup.php
M repo/includes/api/ModifyEntity.php
M repo/includes/store/sql/EntityPerPageBuilder.php
M repo/includes/store/sql/ItemsPerSiteBuilder.php
M repo/includes/store/sql/PropertyInfoTableBuilder.php
M repo/includes/store/sql/TermSearchKeyBuilder.php
14 files changed, 56 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/93/177193/1

diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index 037dfcd..8d4f72c 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -51,7 +51,7 @@
const HISTORY_ENTRY_ACTION = 16;
 
/**
-* @var PageUpdater $updater
+* @var PageUpdater
 */
private $updater;
 
@@ -263,7 +263,7 @@
 *
 * @param EntityChange $change The Change that caused the update
 *
-* @return array|boolean an array of RC attributes,
+* @return array[]|bool an array of RC attributes,
 * or false if the change does not provide edit meta data
 */
private function getRCAttributes( EntityChange $change ) {
diff --git a/client/includes/store/UsageUpdater.php 
b/client/includes/store/UsageUpdater.php
index 77ee7a6..81f8c35 100644
--- a/client/includes/store/UsageUpdater.php
+++ b/client/includes/store/UsageUpdater.php
@@ -18,7 +18,7 @@
 class UsageUpdater {
 
/**
-* @var string $clientId
+* @var string
 */
private $clientId;
 
diff --git a/client/includes/store/sql/DirectSqlStore.php 
b/client/includes/store/sql/DirectSqlStore.php
index 251bcc6..88ea5fa 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -71,7 +71,7 @@
private $entityIdParser;
 
/**
-* @var String|bool $repoWiki
+* @var string|bool
 */
protected $repoWiki;
 
@@ -124,7 +124,7 @@
 * @param EntityContentDataCodec $contentCodec
 * @param Language $wikiLanguage
 * @param EntityIdParser $entityIdParser
-* @param string $repoWiki the symbolic database name of the repo wiki
+* @param string|bool $repoWiki the symbolic database name of the repo 
wiki
 */
public function __construct(
EntityContentDataCodec $contentCodec,
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index 57b5d06..a8608bd 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
@@ -39,7 +39,9 @@
  */
 class ChangeHandlerTest extends \MediaWikiTestCase {
 
-   /** @var Site $site */
+   /**
+* @var Site
+*/
protected $site;
 
protected function setUp() {
diff --git a/client/tests/phpunit/includes/LangLinkHandlerTest.php 
b/client/tests/phpunit/includes/LangLinkHandlerTest.php
index e98fb3e..837fba6 100644
--- a/client/tests/phpunit/includes/LangLinkHandlerTest.php
+++ b/client/tests/phpunit/includes/LangLinkHandlerTest.php
@@ -31,12 +31,12 @@
 class LangLinkHandlerTest extends \MediaWikiTestCase {
 
/**
-* @var MockRepository $mockRepo
+* @var MockRepository
 */
private $mockRepo;
 
/**
-* @var LangLinkHandler $langLinkHandler
+* @var LangLinkHandler
 */
private $langLinkHandler;
 
diff --git a/lib/includes/ChangeNotificationJob.php 
b/lib/includes/ChangeNotificationJob.php
index fdc8be4..1b5ee5a 100644
--- a/lib/includes/ChangeNotificationJob.php
+++ b/lib/includes/ChangeNotificationJob.php
@@ -16,7 +16,7 @@
 class ChangeNotificationJob extends \Job {
 
/**
-* @var Change[] $changes: initialized lazily by getChanges().
+* @var Change[]|null
 */
private $changes = null;
 
@@ -123,9 +123,7 @@
}
 
/**
-* Run the job

[MediaWiki-commits] [Gerrit] Rename getSiteLinkTable to getSiteLinkLookup - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177194

Change subject: Rename getSiteLinkTable to getSiteLinkLookup
..

Rename getSiteLinkTable to getSiteLinkLookup

Looks like the interface was introduced later and that's why the
getter is called after the sub class instead of the interface.

Change-Id: Ib41e33e8306ac4cdf7d82342a5b72784c08405b3
---
M client/WikibaseClient.hooks.php
M client/includes/WikibaseClient.php
M client/includes/hooks/UpdateRepoHookHandlers.php
M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
M client/includes/store/ClientStore.php
M client/includes/store/sql/DirectSqlStore.php
M client/tests/phpunit/MockClientStore.php
M client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
8 files changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/94/177194/1

diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index ad9078e..a10073f 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -174,7 +174,7 @@
public static function onSpecialMovepageAfterMove( MovePageForm 
$movePage, Title $oldTitle,
Title $newTitle ) {
$wikibaseClient = WikibaseClient::getDefaultInstance();
-   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkTable();
+   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkLookup();
$repoLinker = $wikibaseClient-newRepoLinker();
 
$movePageNotice = new MovePageNoticeCreator(
@@ -377,7 +377,7 @@
}
 
$wikibaseClient = WikibaseClient::getDefaultInstance();
-   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkTable();
+   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkLookup();
return $siteLinkLookup-getEntityIdForSiteLink(
new SiteLink(
$wikibaseClient-getSite()-getGlobalId(),
@@ -672,7 +672,7 @@
$infoActionHookHandler = new InfoActionHookHandler(
$namespaceChecker,
$wikibaseClient-newRepoLinker(),
-   $wikibaseClient-getStore()-getSiteLinkTable(),
+   $wikibaseClient-getStore()-getSiteLinkLookup(),
$settings-getSetting( 'siteGlobalID' )
);
 
@@ -692,7 +692,7 @@
 */
public static function onArticleDeleteAfterSuccess( Title $title, 
OutputPage $out ) {
$wikibaseClient = WikibaseClient::getDefaultInstance();
-   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkTable();
+   $siteLinkLookup = 
$wikibaseClient-getStore()-getSiteLinkLookup();
$repoLinker = $wikibaseClient-newRepoLinker();
 
$deletePageNotice = new DeletePageNoticeCreator(
diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 7ed0f92..1a0f182 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -536,7 +536,7 @@
$this-getLanguageLinkBadgeDisplay(),
$this-settings-getSetting( 'siteGlobalID' ),
$this-getNamespaceChecker(),
-   $this-getStore()-getSiteLinkTable(),
+   $this-getStore()-getSiteLinkLookup(),
$this-getStore()-getEntityLookup(),
$this-getSiteStore()-getSites(),
$this-getLangLinkSiteGroup()
@@ -645,7 +645,7 @@
public function getOtherProjectsSidebarGeneratorFactory() {
return new OtherProjectsSidebarGeneratorFactory(
$this-settings,
-   $this-getStore()-getSiteLinkTable(),
+   $this-getStore()-getSiteLinkLookup(),
$this-getSiteStore()
);
}
@@ -704,7 +704,7 @@
public function getPropertyParserFunctionRunner() {
return new Runner(
$this-getPropertyClaimsRendererFactory(),
-   $this-getStore()-getSiteLinkTable(),
+   $this-getStore()-getSiteLinkLookup(),
$this-settings-getSetting( 'siteGlobalID' )
);
}
diff --git a/client/includes/hooks/UpdateRepoHookHandlers.php 
b/client/includes/hooks/UpdateRepoHookHandlers.php
index 45566a2..e609901 100644
--- a/client/includes/hooks/UpdateRepoHookHandlers.php
+++ b/client/includes/hooks/UpdateRepoHookHandlers.php
@@ -75,7 +75,7 @@
return true;
}
 
-   $siteLinkLookup = 
$wikibaseClient

[MediaWiki-commits] [Gerrit] Clean up ItemsPerSiteBuilderTest - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177195

Change subject: Clean up ItemsPerSiteBuilderTest
..

Clean up ItemsPerSiteBuilderTest

I may be wrong but I don't think it's a good idea to make this Item
static.

Also the getter seems unnecesarry. Simplified to a const.

Change-Id: I147c709c2b6ff64b3a6a5898bff13fc30e4cc6b3
---
M repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php
1 file changed, 24 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/95/177195/1

diff --git a/repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php 
b/repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php
index d04b516..9c953d7 100644
--- a/repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php
+++ b/repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php
@@ -21,12 +21,8 @@
  * @author Marius Hoch  h...@online.de 
  */
 class ItemsPerSiteBuilderTest extends \MediaWikiTestCase {
-   /**
-* @return int
-*/
-   private function getBatchSize() {
-   return 5;
-   }
+
+   const BATCH_SIZE = 5;
 
/**
 * @return ItemId
@@ -39,48 +35,43 @@
 * @return Item
 */
private function getTestItem() {
-   static $item = null;
-
-   if ( !$item  ) {
-   $item = Item::newEmpty();
-   $item-setId( $this-getTestItemId() );
-   }
-
+   $item = Item::newEmpty();
+   $item-setId( $this-getTestItemId() );
return $item;
}
 
/**
 * @return SiteLinkTable
 */
-   private function getSiteLinkTableMock() {
-   $siteLinkTableMock = $this-getMockBuilder( 
'Wikibase\Lib\Store\SiteLinkTable' )
+   private function getSiteLinkTable() {
+   $mock = $this-getMockBuilder( 
'Wikibase\Lib\Store\SiteLinkTable' )
-disableOriginalConstructor()
-getMock();
 
$item = $this-getTestItem();
-   $siteLinkTableMock-expects( $this-exactly( 10 ) )
+   $mock-expects( $this-exactly( 10 ) )
-method( 'saveLinksOfItem' )
-will( $this-returnValue( true ) )
-with( $this-equalTo( $item ) );
 
-   return $siteLinkTableMock;
+   return $mock;
}
 
/**
 * @return EntityLookup
 */
-   private function getEntityLookupMock() {
-   $entityLookupMock = $this-getMockBuilder( 
'Wikibase\Lib\Store\EntityLookup' )
+   private function getEntityLookup() {
+   $mock = $this-getMockBuilder( 
'Wikibase\Lib\Store\EntityLookup' )
-disableOriginalConstructor()
-getMock();
 
$item = $this-getTestItem();
-   $entityLookupMock-expects( $this-exactly( 10 ) )
+   $mock-expects( $this-exactly( 10 ) )
-method( 'getEntity' )
-will( $this-returnValue( $item ) )
-with( $this-equalTo( $this-getTestItemId() ) );
 
-   return $entityLookupMock;
+   return $mock;
}
 
/**
@@ -88,8 +79,8 @@
 */
private function getItemsPerSiteBuilder() {
return new ItemsPerSiteBuilder(
-   $this-getSiteLinkTableMock(),
-   $this-getEntityLookupMock()
+   $this-getSiteLinkTable(),
+   $this-getEntityLookup()
);
}
 
@@ -97,7 +88,7 @@
 * @return EntityIdPager
 */
private function getEntityIdPager() {
-   $entityIdPager = $this-getMock( 
'Wikibase\Repo\Store\EntityIdPager' );
+   $mock = $this-getMock( 'Wikibase\Repo\Store\EntityIdPager' );
 
$itemIds = array(
$this-getTestItemId(),
@@ -107,27 +98,27 @@
$this-getTestItemId()
);
 
-   $entityIdPager-expects( $this-at( 0 ) )
+   $mock-expects( $this-at( 0 ) )
-method( 'fetchIds' )
-will( $this-returnValue( $itemIds ) )
-   -with( $this-equalTo( $this-getBatchSize() ) );
+   -with( $this-equalTo( self::BATCH_SIZE ) );
 
-   $entityIdPager-expects( $this-at( 1 ) )
+   $mock-expects( $this-at( 1 ) )
-method( 'fetchIds' )
-will( $this-returnValue( $itemIds ) )
-   -with( $this-equalTo( $this-getBatchSize() ) );
+   -with( $this-equalTo( self::BATCH_SIZE

[MediaWiki-commits] [Gerrit] Clean up MockClientStore - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177197

Change subject: Clean up MockClientStore
..

Clean up MockClientStore

Again, I don't think it's a good idea to make these objects static.
I may be wrong.

Change-Id: I5313b4f774a6a99c8427a2ea4f783d09f0f39eb3
---
M client/tests/phpunit/MockClientStore.php
1 file changed, 103 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/97/177197/1

diff --git a/client/tests/phpunit/MockClientStore.php 
b/client/tests/phpunit/MockClientStore.php
index 9b6d402..3609dca 100644
--- a/client/tests/phpunit/MockClientStore.php
+++ b/client/tests/phpunit/MockClientStore.php
@@ -2,11 +2,19 @@
 
 namespace Wikibase\Test;
 
+use Wikibase\ChangesTable;
+use Wikibase\Client\Store\EntityIdLookup;
 use Wikibase\Client\Usage\NullUsageTracker;
 use Wikibase\Client\Usage\SubscriptionManager;
+use Wikibase\Client\Usage\UsageLookup;
+use Wikibase\Client\Usage\UsageTracker;
 use Wikibase\ClientStore;
+use Wikibase\Lib\Store\EntityLookup;
+use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\SiteLinkLookup;
 use Wikibase\PropertyInfoStore;
+use Wikibase\PropertyLabelResolver;
+use Wikibase\TermIndex;
 
 /**
  * (Incomplete) ClientStore mock
@@ -15,48 +23,119 @@
  *
  * @license GNU GPL v2+
  * @author Marius Hoch  h...@online.de 
+ * @author Thiemo Mättig
  */
 class MockClientStore implements ClientStore {
 
+   /**
+* @var MockRepository|null
+*/
+   private $mockRepository = null;
+
+   /**
+* @var MockPropertyInfoStore|null
+*/
+   private $mockPropertyInfoStore = null;
+
+   /**
+* @see ClientStore::getUsageLookup
+*
+* @return UsageLookup
+*/
public function getUsageLookup() {
return new NullUsageTracker();
}
 
+   /**
+* @see ClientStore::getUsageTracker
+*
+* @return UsageTracker
+*/
public function getUsageTracker() {
return new NullUsageTracker();
}
 
+   /**
+* @see ClientStore::getSubscriptionManager
+*
+* @return SubscriptionManager
+*/
public function getSubscriptionManager() {
return new SubscriptionManager();
}
-   public function getPropertyLabelResolver() {}
-   public function getTermIndex() {}
-   public function getEntityIdLookup() {}
-   public function newChangesTable() {}
-   public function clear() {}
-   public function rebuild() {}
 
-   private function getMock() {
-   static $mockRepo = false;
-   if ( !$mockRepo ) {
-   $mockRepo = new MockRepository();
-   }
-
-   return $mockRepo;
+   /**
+* @see ClientStore::getPropertyLabelResolver
+*
+* @return PropertyLabelResolver
+*/
+   public function getPropertyLabelResolver() {
+   // FIXME: Incomplete
}
 
-   /*
+   /**
+* @see ClientStore::getTermIndex
+*
+* @return TermIndex
+*/
+   public function getTermIndex() {
+   // FIXME: Incomplete
+   }
+
+   /**
+* @see ClientStore::getEntityIdLookup
+*
+* @return EntityIdLookup
+*/
+   public function getEntityIdLookup() {
+   // FIXME: Incomplete
+   }
+
+   /**
+* @see ClientStore::newChangesTable
+*
+* @return ChangesTable
+*/
+   public function newChangesTable() {
+   // FIXME: Incomplete
+   }
+
+   /**
+* @see ClientStore::clear
+*/
+   public function clear() {
+   }
+
+   /**
+* @see ClientStore::rebuild
+*/
+   public function rebuild() {
+   }
+
+   private function getMockRepository() {
+   if ( $this-mockRepository === null ) {
+   $this-mockRepository = new MockRepository();
+   }
+
+   return $this-mockRepository;
+   }
+
+   /**
+* @see ClientStore::getEntityLookup
+*
 * @return EntityLookup
 */
public function getEntityLookup() {
-   return $this-getMock();
+   return $this-getMockRepository();
}
 
-   /*
+   /**
+* @see ClientStore::getEntityRevisionLookup
+*
 * @return EntityRevisionLookup
 */
public function getEntityRevisionLookup() {
-   return $this-getMock();
+   return $this-getMockRepository();
}
 
/**
@@ -65,18 +144,20 @@
 * @return SiteLinkLookup
 */
public function getSiteLinkLookup() {
-   return $this-getMock();
+   return

[MediaWiki-commits] [Gerrit] Clean up MockPropertyLabelResolver - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177198

Change subject: Clean up MockPropertyLabelResolver
..

Clean up MockPropertyLabelResolver

Change-Id: Ibad4935c6ebd4b726cf2d61bd2fc62e702d233a5
---
M lib/tests/phpunit/MockPropertyLabelResolver.php
1 file changed, 20 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/98/177198/1

diff --git a/lib/tests/phpunit/MockPropertyLabelResolver.php 
b/lib/tests/phpunit/MockPropertyLabelResolver.php
index 2a454fc..d9627cf 100644
--- a/lib/tests/phpunit/MockPropertyLabelResolver.php
+++ b/lib/tests/phpunit/MockPropertyLabelResolver.php
@@ -14,37 +14,43 @@
  */
 class MockPropertyLabelResolver implements PropertyLabelResolver {
 
-   protected $repo;
-
-   protected $lang;
+   /**
+* @var MockRepository
+*/
+   private $mockRepository;
 
/**
-* @param string  $lang
-* @param MockRepository $repo
+* @var string
 */
-   public function __construct( $lang, MockRepository $repo ) {
-   $this-lang = $lang;
-   $this-repo = $repo;
+   private $languageCode;
+
+   /**
+* @param string $languageCode
+* @param MockRepository $mockRepository
+*/
+   public function __construct( $languageCode, MockRepository 
$mockRepository ) {
+   $this-languageCode = $languageCode;
+   $this-mockRepository = $mockRepository;
}
 
/**
-* @param string[] $labels  the labels
+* @param string[] $labels
 * @param string   $recache ignored
 *
 * @return EntityId[] a map of strings from $labels to the 
corresponding entity ID.
 */
public function getPropertyIdsForLabels( array $labels, $recache = '' ) 
{
-   $ids = array();
+   $entityIds = array();
 
foreach ( $labels as $label ) {
-   $prop = $this-repo-getPropertyByLabel( $label, 
$this-lang );
+   $entity = $this-mockRepository-getPropertyByLabel( 
$label, $this-languageCode );
 
-   if ( $prop !== null ) {
-   $ids[$label] = $prop-getId();
+   if ( $entity !== null ) {
+   $entityIds[$label] = $entity-getId();
}
}
 
-   return $ids;
+   return $entityIds;
}
 
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/177198
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibad4935c6ebd4b726cf2d61bd2fc62e702d233a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Rename ambiguous $repo to $wikibaseRepo - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177200

Change subject: Rename ambiguous $repo to $wikibaseRepo
..

Rename ambiguous $repo to $wikibaseRepo

This is split from I04767f2.

Change-Id: Idc31b4b81fca351358f659f8f3f8fbaa2ebe61d5
---
M repo/includes/View/SiteLinksView.php
M repo/includes/api/EditEntity.php
M repo/includes/api/MergeItems.php
M repo/includes/api/ModifyEntity.php
M repo/includes/content/EntityContent.php
M repo/includes/specials/SpecialEntityData.php
M repo/includes/specials/SpecialMergeItems.php
M repo/includes/specials/SpecialSetSiteLink.php
8 files changed, 41 insertions(+), 45 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/00/177200/1

diff --git a/repo/includes/View/SiteLinksView.php 
b/repo/includes/View/SiteLinksView.php
index cbc15d7..d158e46 100644
--- a/repo/includes/View/SiteLinksView.php
+++ b/repo/includes/View/SiteLinksView.php
@@ -63,9 +63,7 @@
$this-languageCode = $languageCode;
 
// @todo inject option/objects instead of using the singleton
-   $repo = WikibaseRepo::getDefaultInstance();
-
-   $settings = $repo-getSettings();
+   $settings = WikibaseRepo::getDefaultInstance()-getSettings();
$this-specialSiteLinkGroups = $settings-getSetting( 
'specialSiteLinkGroups' );
$this-badgeItems = $settings-getSetting( 'badgeItems' );
}
diff --git a/repo/includes/api/EditEntity.php b/repo/includes/api/EditEntity.php
index 2d246d0..5445a54 100644
--- a/repo/includes/api/EditEntity.php
+++ b/repo/includes/api/EditEntity.php
@@ -84,8 +84,7 @@
 
$this-validLanguageCodes = array_flip( 
Utils::getLanguageCodes() );
 
-   $repo = WikibaseRepo::getDefaultInstance();
-   $changeOpFactoryProvider = $repo-getChangeOpFactoryProvider();
+   $changeOpFactoryProvider = 
WikibaseRepo::getDefaultInstance()-getChangeOpFactoryProvider();
$this-termChangeOpFactory = 
$changeOpFactoryProvider-getFingerprintChangeOpFactory();
$this-claimChangeOpFactory = 
$changeOpFactoryProvider-getClaimChangeOpFactory();
$this-siteLinkChangeOpFactory = 
$changeOpFactoryProvider-getSiteLinkChangeOpFactory();
diff --git a/repo/includes/api/MergeItems.php b/repo/includes/api/MergeItems.php
index 4c6484f..9d4dab6 100644
--- a/repo/includes/api/MergeItems.php
+++ b/repo/includes/api/MergeItems.php
@@ -53,18 +53,18 @@
public function __construct( ApiMain $mainModule, $moduleName, 
$modulePrefix = '' ) {
parent::__construct( $mainModule, $moduleName, $modulePrefix );
 
-   $repo = WikibaseRepo::getDefaultInstance();
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
 
$this-setServices(
-   $repo-getEntityIdParser(),
-   $repo-getApiHelperFactory()-getErrorReporter( $this ),
-   $repo-getApiHelperFactory()-getResultBuilder( $this ),
+   $wikibaseRepo-getEntityIdParser(),
+   $wikibaseRepo-getApiHelperFactory()-getErrorReporter( 
$this ),
+   $wikibaseRepo-getApiHelperFactory()-getResultBuilder( 
$this ),
new ItemMergeInteractor(
-   
$repo-getChangeOpFactoryProvider()-getMergeChangeOpFactory(),
-   $repo-getEntityRevisionLookup( 'uncached' ),
-   $repo-getEntityStore(),
-   $repo-getEntityPermissionChecker(),
-   $repo-getSummaryFormatter(),
+   
$wikibaseRepo-getChangeOpFactoryProvider()-getMergeChangeOpFactory(),
+   $wikibaseRepo-getEntityRevisionLookup( 
'uncached' ),
+   $wikibaseRepo-getEntityStore(),
+   $wikibaseRepo-getEntityPermissionChecker(),
+   $wikibaseRepo-getSummaryFormatter(),
$this-getUser()
)
);
diff --git a/repo/includes/api/ModifyEntity.php 
b/repo/includes/api/ModifyEntity.php
index 8696afe..6ad1065 100644
--- a/repo/includes/api/ModifyEntity.php
+++ b/repo/includes/api/ModifyEntity.php
@@ -81,19 +81,20 @@
public function __construct( ApiMain $mainModule, $moduleName, 
$modulePrefix = '' ) {
parent::__construct( $mainModule, $moduleName, $modulePrefix );
 
-   $repo = WikibaseRepo::getDefaultInstance();
+   $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+   $settings = $wikibaseRepo-getSettings();
 
//TODO: provide a mechanism to override the services
-   $this-stringNormalizer

[MediaWiki-commits] [Gerrit] Fix mistakes in AffectedPagesFinder and UsageAspectTransformer - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177206

Change subject: Fix mistakes in AffectedPagesFinder and UsageAspectTransformer
..

Fix mistakes in AffectedPagesFinder and UsageAspectTransformer

This is a follow up for the small mistakes I found in I9ce6a2e.

Change-Id: Ie620cb12220e672d435bb53c72eb8f15d8ea1ac7
---
M client/includes/Changes/AffectedPagesFinder.php
M client/includes/Usage/NullUsageTracker.php
M client/includes/Usage/UsageAspectTransformer.php
3 files changed, 97 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/06/177206/1

diff --git a/client/includes/Changes/AffectedPagesFinder.php 
b/client/includes/Changes/AffectedPagesFinder.php
index 8355d35..78e7768 100644
--- a/client/includes/Changes/AffectedPagesFinder.php
+++ b/client/includes/Changes/AffectedPagesFinder.php
@@ -18,11 +18,11 @@
 use Wikibase\Client\Usage\PageEntityUsages;
 use Wikibase\Client\Usage\UsageAspectTransformer;
 use Wikibase\Client\Usage\UsageLookup;
-use Wikibase\EntityChange;
-use Wikibase\ItemChange;
 use Wikibase\DataModel\Entity\Diff\EntityDiff;
 use Wikibase\DataModel\Entity\Diff\ItemDiff;
 use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\EntityChange;
+use Wikibase\ItemChange;
 use Wikibase\Lib\Store\StorageException;
 use Wikibase\NamespaceChecker;
 
@@ -45,6 +45,11 @@
private $namespaceChecker;
 
/**
+* @var TitleFactory
+*/
+   private $titleFactory;
+
+   /**
 * @var string
 */
private $siteId;
@@ -55,14 +60,9 @@
private $contentLanguageCode;
 
/**
-* @var boolean
+* @var bool
 */
private $checkPageExistence;
-
-   /**
-* @var TitleFactory
-*/
-   private $titleFactory;
 
/**
 * @param UsageLookup $usageLookup
@@ -70,7 +70,7 @@
 * @param TitleFactory $titleFactory
 * @param string $siteId
 * @param string $contentLanguageCode
-* @param boolean $checkPageExistence
+* @param bool $checkPageExistence
 *
 * @throws InvalidArgumentException
 */
@@ -96,10 +96,10 @@
 
$this-usageLookup = $usageLookup;
$this-namespaceChecker = $namespaceChecker;
+   $this-titleFactory = $titleFactory;
$this-siteId = $siteId;
$this-contentLanguageCode = $contentLanguageCode;
$this-checkPageExistence = $checkPageExistence;
-   $this-titleFactory = $titleFactory;
}
 
/**
@@ -110,14 +110,12 @@
 * @return IteratorPageEntityUsages
 */
public function getAffectedUsagesByPage( Change $change ) {
-   if ( ! ( $change instanceof EntityChange ) ) {
-   return array();
+   if ( $change instanceof EntityChange ) {
+   $usages = $this-getAffectedPages( $change );
+   return $this-filterUpdates( $usages );
}
 
-   $pageUpdates = $this-getAffectedPages( $change );
-   $pageUpdates = $this-filterUpdates( $pageUpdates );
-
-   return $pageUpdates;
+   return array();
}
 
/**
@@ -128,25 +126,26 @@
public function getChangedAspects( EntityChange $change ) {
$aspects = array();
 
-   /** @var EntityDiff $diff */
$diff = $change-getDiff();
$remainingDiffOps = count( $diff ); // this is a deep count!
 
-   if ( $diff instanceof ItemDiff  
!$diff-getSiteLinkDiff()-isEmpty() ) {
-   $sitelinkDiff = $diff-getSiteLinkDiff();
+   if ( $diff instanceof ItemDiff  
$diff-getSiteLinkDiff()-isEmpty() ) {
+   $siteLinkDiff = $diff-getSiteLinkDiff();
 
$aspects[] = EntityUsage::SITELINK_USAGE;
-   $remainingDiffOps-= count( $sitelinkDiff );
+   $remainingDiffOps -= count( $siteLinkDiff );
 
-   if ( isset( $sitelinkDiff[$this-siteId] )  
!$this-isBadgesOnlyChange( $sitelinkDiff[$this-siteId] ) ) {
+   if ( isset( $siteLinkDiff[$this-siteId] )
+!$this-isBadgesOnlyChange( 
$siteLinkDiff[$this-siteId] )
+   ) {
$aspects[] = EntityUsage::TITLE_USAGE;
}
}
 
-   if ( !$diff-getLabelsDiff()-isEmpty() ) {
-   $labelDiff = $diff-getLabelsDiff();
+   if ( $diff instanceof EntityDiff  
!$diff-getLabelsDiff()-isEmpty() ) {
+   $labelsDiff = $diff-getLabelsDiff();
 
-   if ( isset( $labelDiff[$this-contentLanguageCode

[MediaWiki-commits] [Gerrit] Remove redundant variable names from @return tags - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177214

Change subject: Remove redundant variable names from @return tags
..

Remove redundant variable names from @return tags

Reason to touch these files are the @return tags.
I also made stuff private in the files I touched.

Change-Id: I679384b7f20b37759d087356258a762f0dc7bfc1
---
M client/includes/scribunto/WikibaseLuaBindings.php
M lib/includes/serializers/LabelSerializer.php
M repo/includes/ClaimSummaryBuilder.php
M repo/includes/api/RemoveQualifiers.php
M repo/includes/api/RemoveReferences.php
M repo/includes/content/EntityHandler.php
6 files changed, 22 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/14/177214/1

diff --git a/client/includes/scribunto/WikibaseLuaBindings.php 
b/client/includes/scribunto/WikibaseLuaBindings.php
index 028c91c..3ae0708 100644
--- a/client/includes/scribunto/WikibaseLuaBindings.php
+++ b/client/includes/scribunto/WikibaseLuaBindings.php
@@ -226,7 +226,7 @@
 *
 * @param string $pageTitle
 *
-* @return string|null $id
+* @return string|null
 */
public function getEntityId( $pageTitle ) {
$id = $this-siteLinkTable-getItemIdForLink( $this-siteId, 
$pageTitle );
diff --git a/lib/includes/serializers/LabelSerializer.php 
b/lib/includes/serializers/LabelSerializer.php
index 8f9e20a..299a8b7 100644
--- a/lib/includes/serializers/LabelSerializer.php
+++ b/lib/includes/serializers/LabelSerializer.php
@@ -89,10 +89,10 @@
 *
 * @since 0.5
 *
-* @param array $data
+* @param array[] $data
 *
 * @throws InvalidArgumentException
-* @return array $labels
+* @return string[]
 */
public function newFromSerialization( array $data ) {
$labels = array();
@@ -114,4 +114,5 @@
 
return $labels;
}
+
 }
diff --git a/repo/includes/ClaimSummaryBuilder.php 
b/repo/includes/ClaimSummaryBuilder.php
index 8254cab..cd5bfd6 100644
--- a/repo/includes/ClaimSummaryBuilder.php
+++ b/repo/includes/ClaimSummaryBuilder.php
@@ -55,7 +55,7 @@
 * @param Claims $existingClaims
 * @param Claim $newClaim
 *
-* @return Summary $summary
+* @return Summary
 */
public function buildClaimSummary( Claims $existingClaims, Claim 
$newClaim ) {
$summary = new Summary( $this-apiModuleName );
@@ -109,7 +109,7 @@
 *
 * @return array[] Associative array that contains property ID = array 
of main Snaks
 */
-   protected function buildSummaryArgs( Claims $claims, array $guids ) {
+   private function buildSummaryArgs( Claims $claims, array $guids ) {
$pairs = array();
 
foreach( $guids as $guid ) {
diff --git a/repo/includes/api/RemoveQualifiers.php 
b/repo/includes/api/RemoveQualifiers.php
index 4492b2e..b08391e 100644
--- a/repo/includes/api/RemoveQualifiers.php
+++ b/repo/includes/api/RemoveQualifiers.php
@@ -25,7 +25,7 @@
/**
 * @var ClaimChangeOpFactory
 */
-   protected $claimChangeOpFactory;
+   private $claimChangeOpFactory;
 
/**
 * @param ApiMain $mainModule
@@ -78,10 +78,8 @@
 
/**
 * Check the provided parameters
-*
-* @since 0.4
 */
-   protected function validateParameters( array $params ) {
+   private function validateParameters( array $params ) {
if ( !( $this-claimModificationHelper-validateClaimGuid( 
$params['claim'] ) ) ) {
$this-dieError( 'Invalid claim guid' , 'invalid-guid' 
);
}
@@ -91,11 +89,11 @@
 * @since 0.4
 *
 * @param string $claimGuid
-* @param array $qualifierHashes
+* @param string[] $qualifierHashes
 *
-* @return ChangeOp[] $changeOps
+* @return ChangeOp[]
 */
-   protected function getChangeOps( $claimGuid, array $qualifierHashes ) {
+   private function getChangeOps( $claimGuid, array $qualifierHashes ) {
$changeOps = array();
 
foreach ( $qualifierHashes as $qualifierHash ) {
@@ -106,14 +104,12 @@
}
 
/**
-* @since 0.4
-*
 * @param array $params
 * @param Claim $claim
 *
 * @return string[]
 */
-   protected function getQualifierHashesFromParams( array $params, Claim 
$claim ) {
+   private function getQualifierHashesFromParams( array $params, Claim 
$claim ) {
$qualifiers = $claim-getQualifiers();
$hashes = array();
 
@@ -194,4 +190,5 @@
'Remove qualifier with hash 
1eb8793c002b1d9820c833d234a1b54c8e94187e from claim with GUID

[MediaWiki-commits] [Gerrit] Delete unused TermMatchScoreCalculator - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177215

Change subject: Delete unused TermMatchScoreCalculator
..

Delete unused TermMatchScoreCalculator

Change-Id: Id4dca502e0b5794029d88ebeae125c5ad965b274
---
D lib/includes/store/TermMatchScoreCalculator.php
1 file changed, 0 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/15/177215/1

diff --git a/lib/includes/store/TermMatchScoreCalculator.php 
b/lib/includes/store/TermMatchScoreCalculator.php
deleted file mode 100644
index d0e7b62..000
--- a/lib/includes/store/TermMatchScoreCalculator.php
+++ /dev/null
@@ -1,61 +0,0 @@
-?php
-
-namespace Wikibase;
-
-/**
- * Calculates and stores score for term search
- *
- * @since 0.3
- *
- * @licence GNU GPL v2+
- * @author Jens Ohlig  jens.oh...@wikimedia.de 
- * @author John Erling Blad  jeb...@gmail.com 
- * @author Tobias Gritschacher  tobias.gritschac...@wikimedia.de 
- */
-
-class TermMatchScoreCalculator {
-
-   protected $entry;
-   protected $searchLength;
-
-   /**
-* Constructor
-*
-* @since 0.3
-*
-* @param array $entry
-* @param string $search
-*/
-   public function __construct( array $entry, $search ) {
-   $this-entry = $entry;
-   $this-searchLength = strlen( $search );
-   }
-
-   /**
-* Calculate score
-*
-* @since 0.3
-*
-* @return integer $score
-*/
-   public function calculateScore() {
-   $score = 0;
-
-   if ( isset( $this-entry['label'] ) ) {
-   $score = $this-searchLength / strlen( 
$this-entry['label'] );
-   }
-
-   if ( isset( $this-entry['aliases'] ) ) {
-   foreach ( $this-entry['aliases'] as $alias ) {
-   $aliasScore = $this-searchLength / strlen( 
$alias );
-
-   if ( $aliasScore  $score ) {
-   $score = $aliasScore;
-   }
-   }
-   }
-
-   return $score;
-   }
-
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/177215
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4dca502e0b5794029d88ebeae125c5ad965b274
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use switch in EntityIdTitleFormatters - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177234

Change subject: Use switch in EntityIdTitleFormatters
..

Use switch in EntityIdTitleFormatters

If it looks like a switch why not use a switch?

Change-Id: If5304b5e309ecf28a45d71c1e3839d487c76c55f
---
M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
M repo/includes/store/sql/ItemsPerSiteBuilder.php
3 files changed, 17 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/34/177234/1

diff --git a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php 
b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
index 4c5ecc9..357c914 100644
--- a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
@@ -58,16 +58,15 @@
$this-assertEquals( $expected, $actual );
}
 
-   public function getTitleForId( EntityId $id ) {
-   if ( $id-getEntityType() === Item::ENTITY_TYPE ) {
-   $name = 'ITEM-TEST--' . $id-getSerialization();
-   } elseif ( $id-getEntityType() === Property::ENTITY_TYPE ) {
-   $name = 'PROPERTY-TEST--' . $id-getSerialization();
-   } else {
-   throw new LogicException( oops! );
+   public function getTitleForId( EntityId $entityId ) {
+   switch ( $entityId-getEntityType() ) {
+   case Item::ENTITY_TYPE:
+   return Title::makeTitle( NS_MAIN, 'ITEM-TEST--' 
. $entityId-getSerialization() );
+   case Property::ENTITY_TYPE:
+   return Title::makeTitle( NS_MAIN, 
'PROPERTY-TEST--' . $entityId-getSerialization() );
+   default:
+   throw new LogicException( oops! );
}
-
-   return Title::makeTitle( NS_MAIN, $name );
}
 
protected function newEntityIdLinkFormatter() {
diff --git a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php 
b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
index 970adf0..6b14262 100644
--- a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
@@ -58,16 +58,15 @@
$this-assertEquals( $expected, $actual );
}
 
-   public function getTitleForId( EntityId $id ) {
-   if ( $id-getEntityType() === Item::ENTITY_TYPE ) {
-   $name = 'ITEM-TEST--' . $id-getSerialization();
-   } elseif ( $id-getEntityType() === Property::ENTITY_TYPE ) {
-   $name = 'PROPERTY-TEST--' . $id-getSerialization();
-   } else {
-   throw new LogicException( oops! );
+   public function getTitleForId( EntityId $entityId ) {
+   switch ( $entityId-getEntityType() ) {
+   case Item::ENTITY_TYPE:
+   return Title::makeTitle( NS_MAIN, 'ITEM-TEST--' 
. $entityId-getSerialization() );
+   case Property::ENTITY_TYPE:
+   return Title::makeTitle( NS_MAIN, 
'PROPERTY-TEST--' . $entityId-getSerialization() );
+   default:
+   throw new LogicException( oops! );
}
-
-   return Title::makeTitle( NS_MAIN, $name );
}
 
protected function newEntityIdTitleFormatter() {
diff --git a/repo/includes/store/sql/ItemsPerSiteBuilder.php 
b/repo/includes/store/sql/ItemsPerSiteBuilder.php
index bc789f9..aed1b17 100644
--- a/repo/includes/store/sql/ItemsPerSiteBuilder.php
+++ b/repo/includes/store/sql/ItemsPerSiteBuilder.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Repo\Store\SQL;
 
+use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\Lib\Reporting\MessageReporter;
 use Wikibase\Lib\Store\EntityLookup;
@@ -92,7 +93,6 @@
private function rebuildSiteLinks( array $entityIds ) {
$c = 0;
foreach ( $entityIds as $entityId ) {
-   /* @var $entityId EntityId */
if ( !$entityId-getEntityType() === Item::ENTITY_TYPE 
) {
// Just in case someone is using a 
EntityIdPager which doesn't filter non-Items
continue;

-- 
To view, visit https://gerrit.wikimedia.org/r/177234
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5304b5e309ecf28a45d71c1e3839d487c76c55f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet

[MediaWiki-commits] [Gerrit] Use 'property' string constant to avoid dependencies - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177237

Change subject: Use 'property' string constant to avoid dependencies
..

Use 'property' string constant to avoid dependencies

Change-Id: I1cfe9dce853f6af63c78422b4ac92a39b10479ce
---
M client/includes/WikibaseClient.php
M lib/includes/EntityFactory.php
M lib/includes/serializers/EntitySerializer.php
M lib/includes/store/TermPropertyLabelResolver.php
M lib/includes/store/sql/SqlEntityInfoBuilder.php
M lib/tests/phpunit/Validators/NotEntityIdValidatorTest.php
M lib/tests/phpunit/entity/EntityFactoryTest.php
M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
M lib/tests/phpunit/serializers/SerializerFactoryTest.php
M lib/tests/phpunit/store/MockPropertyInfoStore.php
M lib/tests/phpunit/store/TermPropertyLabelResolverTest.php
M repo/includes/Validators/EntityConstraintProvider.php
M repo/includes/Validators/TermValidatorFactory.php
M repo/includes/WikibaseRepo.php
M repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
M repo/tests/phpunit/includes/LabelDescriptionDuplicateDetectorTest.php
M repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
18 files changed, 34 insertions(+), 51 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/37/177237/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index d3cb261..6250f26 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -31,7 +31,6 @@
 use Wikibase\DataModel\Entity\DispatchingEntityIdParser;
 use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\Item;
-use Wikibase\DataModel\Entity\Property;
 use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\DirectSqlStore;
 use Wikibase\EntityFactory;
@@ -584,7 +583,7 @@
public function getEntityFactory() {
$entityClasses = array(
Item::ENTITY_TYPE = 'Wikibase\DataModel\Entity\Item',
-   Property::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Property',
+   'property' = 'Wikibase\DataModel\Entity\Property',
);
 
//TODO: provide a hook or registry for adding more.
diff --git a/lib/includes/EntityFactory.php b/lib/includes/EntityFactory.php
index 75e699e..b2b8df1 100644
--- a/lib/includes/EntityFactory.php
+++ b/lib/includes/EntityFactory.php
@@ -6,7 +6,6 @@
 use OutOfBoundsException;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
-use Wikibase\DataModel\Entity\Property;
 
 /**
  * Factory for Entity objects.
@@ -50,7 +49,7 @@
if ( $instance === false ) {
$typeToClass = array(
Item::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Item',
-   Property::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Property',
+   'property' = 
'Wikibase\DataModel\Entity\Property',
);
 
$instance = new static( $typeToClass );
diff --git a/lib/includes/serializers/EntitySerializer.php 
b/lib/includes/serializers/EntitySerializer.php
index 4d0b9cb..cbb955c 100644
--- a/lib/includes/serializers/EntitySerializer.php
+++ b/lib/includes/serializers/EntitySerializer.php
@@ -7,7 +7,6 @@
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
-use Wikibase\DataModel\Entity\Property;
 use Wikibase\EntityFactory;
 
 /**
@@ -98,7 +97,7 @@
$this-entityFactory = new EntityFactory(
array(
Item::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Item',
-   Property::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Property',
+   'property' = 
'Wikibase\DataModel\Entity\Property',
)
);
} else {
diff --git a/lib/includes/store/TermPropertyLabelResolver.php 
b/lib/includes/store/TermPropertyLabelResolver.php
index 7530d45..d3fafa4 100644
--- a/lib/includes/store/TermPropertyLabelResolver.php
+++ b/lib/includes/store/TermPropertyLabelResolver.php
@@ -4,7 +4,6 @@
 
 use BagOStuff;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Entity\Property;
 use Wikibase\DataModel\Entity\PropertyId;
 
 /**
@@ -126,13 +125,13 @@
$termTemplate = new Term( array(
'termType' = 'label',
'termLanguage' = $this-lang,
-   'entityType' = Property::ENTITY_TYPE
+   'entityType' = 'property',
) );
 
$terms = $this-termIndex

[MediaWiki-commits] [Gerrit] Use 'item' string constant to avoid dependencies - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177239

Change subject: Use 'item' string constant to avoid dependencies
..

Use 'item' string constant to avoid dependencies

Change-Id: Ic351337fa19913d8247853fe3b250cbf7cc49994
---
M client/includes/WikibaseClient.php
M lib/includes/EntityFactory.php
M lib/includes/serializers/EntitySerializer.php
M lib/tests/phpunit/entity/EntityFactoryTest.php
M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
M lib/tests/phpunit/store/TermPropertyLabelResolverTest.php
M repo/includes/Validators/EntityConstraintProvider.php
M repo/includes/Validators/TermValidatorFactory.php
M repo/includes/WikibaseRepo.php
M repo/includes/store/sql/EntityPerPageTable.php
M repo/includes/store/sql/ItemsPerSiteBuilder.php
M repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
M repo/tests/phpunit/includes/LabelDescriptionDuplicateDetectorTest.php
M repo/tests/phpunit/includes/Validators/EntityConstraintProviderTest.php
M repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
17 files changed, 35 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/39/177239/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 6250f26..9d7bfd9 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -30,7 +30,6 @@
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\DispatchingEntityIdParser;
 use Wikibase\DataModel\Entity\EntityIdParser;
-use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\DirectSqlStore;
 use Wikibase\EntityFactory;
@@ -582,7 +581,7 @@
 */
public function getEntityFactory() {
$entityClasses = array(
-   Item::ENTITY_TYPE = 'Wikibase\DataModel\Entity\Item',
+   'item' = 'Wikibase\DataModel\Entity\Item',
'property' = 'Wikibase\DataModel\Entity\Property',
);
 
@@ -661,7 +660,7 @@
public function getEntityChangeFactory() {
//TODO: take this from a setting or registry.
$changeClasses = array(
-   Item::ENTITY_TYPE = 'Wikibase\ItemChange',
+   'item' = 'Wikibase\ItemChange',
// Other types of entities will use EntityChange
);
 
diff --git a/lib/includes/EntityFactory.php b/lib/includes/EntityFactory.php
index b2b8df1..f42f4dd 100644
--- a/lib/includes/EntityFactory.php
+++ b/lib/includes/EntityFactory.php
@@ -5,7 +5,6 @@
 use MWException;
 use OutOfBoundsException;
 use Wikibase\DataModel\Entity\Entity;
-use Wikibase\DataModel\Entity\Item;
 
 /**
  * Factory for Entity objects.
@@ -48,7 +47,7 @@
 
if ( $instance === false ) {
$typeToClass = array(
-   Item::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Item',
+   'item' = 'Wikibase\DataModel\Entity\Item',
'property' = 
'Wikibase\DataModel\Entity\Property',
);
 
diff --git a/lib/includes/serializers/EntitySerializer.php 
b/lib/includes/serializers/EntitySerializer.php
index cbb955c..e87894d 100644
--- a/lib/includes/serializers/EntitySerializer.php
+++ b/lib/includes/serializers/EntitySerializer.php
@@ -6,7 +6,6 @@
 use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
-use Wikibase\DataModel\Entity\Item;
 use Wikibase\EntityFactory;
 
 /**
@@ -96,7 +95,7 @@
// which currently allows all parameters to be null.
$this-entityFactory = new EntityFactory(
array(
-   Item::ENTITY_TYPE = 
'Wikibase\DataModel\Entity\Item',
+   'item' = 
'Wikibase\DataModel\Entity\Item',
'property' = 
'Wikibase\DataModel\Entity\Property',
)
);
diff --git a/lib/tests/phpunit/entity/EntityFactoryTest.php 
b/lib/tests/phpunit/entity/EntityFactoryTest.php
index 46f5cb3..5a94a64 100644
--- a/lib/tests/phpunit/entity/EntityFactoryTest.php
+++ b/lib/tests/phpunit/entity/EntityFactoryTest.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase\Test;
 
-use Wikibase\DataModel\Entity\Item;
 use Wikibase\EntityFactory;
 
 /**
@@ -21,7 +20,7 @@
$types = EntityFactory::singleton()-getEntityTypes();
$this-assertInternalType( 'array', $types );
 
-   $this-assertTrue( in_array

[MediaWiki-commits] [Gerrit] Formatters for JSON? - change (mediawiki...Wikibase)

2014-12-03 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177258

Change subject: Formatters for JSON?
..

Formatters for JSON?

A Formatter that outputs JSON is not a Formatter, that's a
Serializer.

Change-Id: Ib91de650f86f65fbb392d30df223b98ca64b59cc
---
M lib/includes/formatters/SnakFormatter.php
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/58/177258/1

diff --git a/lib/includes/formatters/SnakFormatter.php 
b/lib/includes/formatters/SnakFormatter.php
index a0d9578..570abe8 100644
--- a/lib/includes/formatters/SnakFormatter.php
+++ b/lib/includes/formatters/SnakFormatter.php
@@ -25,7 +25,6 @@
const FORMAT_HTML = 'text/html';
const FORMAT_HTML_WIDGET = 'text/html; disposition=widget';
const FORMAT_HTML_DIFF = 'text/html; disposition=diff';
-   const FORMAT_JSON = 'application/json';
 
/**
 * Formats a snak.

-- 
To view, visit https://gerrit.wikimedia.org/r/177258
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib91de650f86f65fbb392d30df223b98ca64b59cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix wrong SqlUsageTrackerSchemaUpdater filename - change (mediawiki...Wikibase)

2014-12-04 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177532

Change subject: Fix wrong SqlUsageTrackerSchemaUpdater filename
..

Fix wrong SqlUsageTrackerSchemaUpdater filename

Change-Id: Ib3782b787997ea9a858acb9b694d6e45955fc01a
---
R client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
1 file changed, 0 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/32/177532/1

diff --git a/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php 
b/client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php
similarity index 100%
rename from client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdate.php
rename to client/includes/Usage/Sql/SqlUsageTrackerSchemaUpdater.php

-- 
To view, visit https://gerrit.wikimedia.org/r/177532
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3782b787997ea9a858acb9b694d6e45955fc01a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix doc tags in EntityUsageTableBuilder - change (mediawiki...Wikibase)

2014-12-04 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/177537

Change subject: Fix doc tags in EntityUsageTableBuilder
..

Fix doc tags in EntityUsageTableBuilder

Change-Id: Ib4fe26631aab3c7707e1f287f45f879ee656ab58
---
M client/includes/Usage/Sql/EntityUsageTableBuilder.php
M client/tests/phpunit/includes/Usage/Sql/EntityUsageTableBuilderTest.php
2 files changed, 7 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/37/177537/1

diff --git a/client/includes/Usage/Sql/EntityUsageTableBuilder.php 
b/client/includes/Usage/Sql/EntityUsageTableBuilder.php
index c229794..25d73ed 100644
--- a/client/includes/Usage/Sql/EntityUsageTableBuilder.php
+++ b/client/includes/Usage/Sql/EntityUsageTableBuilder.php
@@ -89,7 +89,7 @@
/**
 * @param MessageReporter $progressReporter
 */
-   public function setProgressReporter( $progressReporter ) {
+   public function setProgressReporter( MessageReporter $progressReporter 
) {
$this-progressReporter = $progressReporter;
}
 
@@ -103,7 +103,7 @@
/**
 * @param ExceptionHandler $exceptionHandler
 */
-   public function setExceptionHandler( $exceptionHandler ) {
+   public function setExceptionHandler( ExceptionHandler $exceptionHandler 
) {
$this-exceptionHandler = $exceptionHandler;
}
 
@@ -224,8 +224,7 @@
$this-exceptionHandler-handleException(
$ex,
'badEntityId',
-   __METHOD__ .': ' .
-   'Failed to parse entity ID: ' .
+   __METHOD__ . ': ' . 'Failed to parse 
entity ID: ' .
$row-pp_value . ' at page ' .
$row-pp_page
);
diff --git 
a/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableBuilderTest.php 
b/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableBuilderTest.php
index 455e7f2..2a0d916 100644
--- a/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableBuilderTest.php
+++ b/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableBuilderTest.php
@@ -2,12 +2,12 @@
 
 namespace Wikibase\Client\Tests\Usage\Sql;
 
-use PHPUnit_Framework_MockObject_Matcher;
 use PHPUnit_Framework_MockObject_Matcher_Invocation;
 use Wikibase\Client\Usage\Sql\EntityUsageTableBuilder;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\Lib\Reporting\ExceptionHandler;
+use Wikibase\Lib\Reporting\MessageReporter;
 
 /**
  * @covers Wikibase\Client\Usage\Sql\EntityUsageTableBuilder
@@ -103,7 +103,7 @@
}
 
/**
-* @param PHPUnit_Framework_MockObject_Matcher $matcher
+* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
 *
 * @return ExceptionHandler
 */
@@ -116,9 +116,9 @@
}
 
/**
-* @param PHPUnit_Framework_MockObject_Matcher $matcher
+* @param PHPUnit_Framework_MockObject_Matcher_Invocation $matcher
 *
-* @return ExceptionHandler
+* @return MessageReporter
 */
private function getMessageReporter( 
PHPUnit_Framework_MockObject_Matcher_Invocation $matcher ) {
$mock = $this-getMock( 
'Wikibase\Lib\Reporting\MessageReporter' );

-- 
To view, visit https://gerrit.wikimedia.org/r/177537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4fe26631aab3c7707e1f287f45f879ee656ab58
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Drop dead and redundant special page code - change (mediawiki...Wikibase)

2014-12-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179114

Change subject: Drop dead and redundant special page code
..

Drop dead and redundant special page code

* SpecialPage::execute() is not supposed to return anything.
  Warning, this possibly causes the only WikibaseQuery special page to
  fail, please merge https://github.com/wmde/WikibaseQuery/pull/60 too!
* Drop redundant SpecialItemResolver class, all methods and properties
  do exist in the base class. Warning, please have a look at the
  message used in the ...-outputHeader( ... ) call, it changes from
  name-summary to wikibase-name-summary now. But none of these
  messages exist for these 3 special pages so it should not make a
  difference.
* Special page names are canonical, never multi-byte, right? No need
  to use Language::lc(), strtolower() is enough.
* Drop unused $subPage property.
* Add some docs.

Change-Id: Iff0728ccaef50ec41dd7a58a431aee6ceec2a493
---
M client/includes/specials/SpecialUnconnectedPages.php
M repo/includes/specials/SpecialDispatchStats.php
M repo/includes/specials/SpecialEntitiesWithoutPage.php
M repo/includes/specials/SpecialEntityData.php
M repo/includes/specials/SpecialGoToLinkedPage.php
M repo/includes/specials/SpecialItemByTitle.php
M repo/includes/specials/SpecialItemDisambiguation.php
D repo/includes/specials/SpecialItemResolver.php
M repo/includes/specials/SpecialItemsWithoutSitelinks.php
M repo/includes/specials/SpecialListDatatypes.php
M repo/includes/specials/SpecialMergeItems.php
M repo/includes/specials/SpecialModifyEntity.php
M repo/includes/specials/SpecialMyLanguageFallbackChain.php
M repo/includes/specials/SpecialNewEntity.php
M repo/includes/specials/SpecialWikibasePage.php
M repo/includes/specials/SpecialWikibaseQueryPage.php
16 files changed, 70 insertions(+), 140 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/14/179114/1

diff --git a/client/includes/specials/SpecialUnconnectedPages.php 
b/client/includes/specials/SpecialUnconnectedPages.php
index 455ad48..29e6eec 100644
--- a/client/includes/specials/SpecialUnconnectedPages.php
+++ b/client/includes/specials/SpecialUnconnectedPages.php
@@ -53,11 +53,18 @@
parent::__construct( 'UnconnectedPages' );
}
 
+   /**
+* @see SpecialPage::getGroupName
+*
+* @return string
+*/
public function getGroupName() {
return 'wikibaseclient';
}
 
/**
+* @see SpecialPage::getDescription
+*
 * @return string
 */
public function getDescription() {
@@ -73,13 +80,11 @@
/**
 * @see SpecialPage::execute
 *
-* @param null|string $subPage
+* @param string|null $subPage
 */
public function execute( $subPage ) {
$this-setHeaders();
-
-   $contLang = $this-getContext()-getLanguage();
-   $this-outputHeader( $contLang-lc( 'wikibase-' . 
$this-getName() ) . '-summary' );
+   $this-outputHeader( 'wikibase-' . strtolower( $this-getName() 
) . '-summary' );
 
// If the user is authorized, display the page, if not, show an 
error.
if ( !$this-userCanExecute( $this-getUser() ) ) {
diff --git a/repo/includes/specials/SpecialDispatchStats.php 
b/repo/includes/specials/SpecialDispatchStats.php
index b040cad..050124e 100644
--- a/repo/includes/specials/SpecialDispatchStats.php
+++ b/repo/includes/specials/SpecialDispatchStats.php
@@ -56,6 +56,11 @@
) );
}
 
+   /**
+* @see SpecialWikibasePage::execute
+*
+* @param string|null $subPage
+*/
public function execute( $subPage ) {
parent::execute( $subPage );
 
diff --git a/repo/includes/specials/SpecialEntitiesWithoutPage.php 
b/repo/includes/specials/SpecialEntitiesWithoutPage.php
index e66e0ba..9975f0f 100644
--- a/repo/includes/specials/SpecialEntitiesWithoutPage.php
+++ b/repo/includes/specials/SpecialEntitiesWithoutPage.php
@@ -75,11 +75,11 @@
 * @see SpecialWikibasePage::execute
 *
 * @since 0.4
+*
+* @param string|null $subPage
 */
public function execute( $subPage ) {
-   if ( !parent::execute( $subPage ) ) {
-   return false;
-   }
+   parent::execute( $subPage );
 
$this-prepareArguments( $subPage );
$this-setForm();
@@ -87,8 +87,6 @@
if ( $this-language !== '' ) {
$this-showQuery();
}
-
-   return true;
}
 
/**
diff --git a/repo/includes/specials/SpecialEntityData.php 
b/repo/includes/specials/SpecialEntityData.php
index dbc3a06..f9571fb 100644
--- a/repo/includes/specials

[MediaWiki-commits] [Gerrit] Fall back to page title if wikibase-titletext is n/a - change (mediawiki...Wikibase)

2014-12-11 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179135

Change subject: Fall back to page title if wikibase-titletext is n/a
..

Fall back to page title if wikibase-titletext is n/a

Change-Id: Ic20c54407447e517e3fd7926060c0bc85013892a
---
M client/includes/Usage/ParserOutputUsageAccumulator.php
M client/includes/hooks/SidebarHookHandlers.php
M repo/Wikibase.hooks.php
M repo/includes/EntityParserOutputGenerator.php
M repo/includes/actions/EditEntityAction.php
M repo/includes/actions/ViewEntityAction.php
6 files changed, 17 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/35/179135/1

diff --git a/client/includes/Usage/ParserOutputUsageAccumulator.php 
b/client/includes/Usage/ParserOutputUsageAccumulator.php
index 59b1528..2a272e2 100644
--- a/client/includes/Usage/ParserOutputUsageAccumulator.php
+++ b/client/includes/Usage/ParserOutputUsageAccumulator.php
@@ -47,7 +47,7 @@
 */
public function getUsages() {
$usages = $this-parserOutput-getExtensionData( 
'wikibase-entity-usage' );
-   return $usages === null ? array() : $usages;
+   return $usages ?: array();
}
 
/**
diff --git a/client/includes/hooks/SidebarHookHandlers.php 
b/client/includes/hooks/SidebarHookHandlers.php
index 51ab7c7..5c8b497 100644
--- a/client/includes/hooks/SidebarHookHandlers.php
+++ b/client/includes/hooks/SidebarHookHandlers.php
@@ -147,25 +147,21 @@
}
 
$noExternalLangLinks = 
NoLangLinkHandler::getNoExternalLangLinks( $parserOutput );
-
if ( !empty( $noExternalLangLinks ) ) {
$out-setProperty( 'noexternallanglinks', 
$noExternalLangLinks );
}
 
$itemId = $parserOutput-getProperty( 'wikibase_item' );
-
if ( $itemId !== false ) {
$out-setProperty( 'wikibase_item', $itemId );
}
 
$otherProjects = $parserOutput-getExtensionData( 
'wikibase-otherprojects-sidebar' );
-
if ( $otherProjects !== null ) {
$out-setProperty( 'wikibase-otherprojects-sidebar', 
$otherProjects );
}
 
$badges = $parserOutput-getExtensionData( 'wikibase_badges' );
-
if ( $badges !== null ) {
$out-setProperty( 'wikibase_badges', $badges );
}
diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index fceee04..7681057 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -956,19 +956,18 @@
 * @return bool
 */
public static function onOutputPageParserOutput( OutputPage $out, 
ParserOutput $parserOutput ) {
+   // Set in EntityParserOutputGenerator.
$placeholders = $parserOutput-getExtensionData( 
'wikibase-view-chunks' );
-
-   if ( $placeholders ) {
+   if ( $placeholders !== null ) {
$out-setProperty( 'wikibase-view-chunks', 
$placeholders );
}
 
-   // used in ViewEntityAction and EditEntityAction to override 
the page html title
+   // Used in ViewEntityAction and EditEntityAction to override 
the page HTML title
// with the label, if available, or else the id. Passed via 
parser output
// and output page to save overhead of fetching content and 
accessing an entity
// on page view.
$titleText = $parserOutput-getExtensionData( 
'wikibase-titletext' );
-
-   if ( $titleText ) {
+   if ( $titleText !== null ) {
$out-setProperty( 'wikibase-titletext', $titleText );
}
 
@@ -988,7 +987,7 @@
public static function onOutputPageBeforeHTML( OutputPage $out, $html 
) {
$placeholders = $out-getProperty( 'wikibase-view-chunks' );
 
-   if ( $placeholders ) {
+   if ( !empty( $placeholders ) ) {
$injector = new TextInjector( $placeholders );
$userLanguageLookup = new UserLanguageLookup();
$expander = new EntityViewPlaceholderExpander(
diff --git a/repo/includes/EntityParserOutputGenerator.php 
b/repo/includes/EntityParserOutputGenerator.php
index cf389f5..23fba58 100644
--- a/repo/includes/EntityParserOutputGenerator.php
+++ b/repo/includes/EntityParserOutputGenerator.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase;
 
-use OutOfBoundsException;
 use ParserOutput;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
@@ -259,7 +258,7 @@
} else {
$entityId = $entity-getId();
 
-   if ( !$entityId ) {
+   if ( $entityId

[MediaWiki-commits] [Gerrit] Rework WikibaseRepo tests - change (mediawiki...Wikibase)

2014-12-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179473

Change subject: Rework WikibaseRepo tests
..

Rework WikibaseRepo tests

* Use willReturn() and willReturnCallback() shortcuts for better
  readability.
* Make stuff private if possible.

Yes, this is way to much in a single patch, I will split it later.

Change-Id: Id990caf8193f8b7b11dccac5715c8d3fbbbf50fa
---
M repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpsTest.php
M repo/tests/phpunit/includes/ContentRetrieverTest.php
M repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
M repo/tests/phpunit/includes/Diff/EntityDiffVisualizerTest.php
M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
M repo/tests/phpunit/includes/EditEntityTest.php
M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php
M repo/tests/phpunit/includes/Hook/LinkBeginHookHandlerTest.php
M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
M repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
M repo/tests/phpunit/includes/Interactors/TokenCheckInteractorTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataUriManagerTest.php
M 
repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
M repo/tests/phpunit/includes/Localizer/MessageParameterFormatterTest.php
M repo/tests/phpunit/includes/OutputPageJsConfigBuilderTest.php
M repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
M repo/tests/phpunit/includes/RepoHooksTest.php
M repo/tests/phpunit/includes/SummaryFormatterTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
M repo/tests/phpunit/includes/Validators/CompositeEntityValidatorTest.php
M repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php
M repo/tests/phpunit/includes/View/ClaimHtmlGeneratorTest.php
M repo/tests/phpunit/includes/View/ClaimsViewTest.php
M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php
M repo/tests/phpunit/includes/View/EntityViewPlaceholderExpanderTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/View/SnakHtmlGeneratorTest.php
M repo/tests/phpunit/includes/api/ApiHelperFactoryTest.php
M repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php
M repo/tests/phpunit/includes/api/GetClaimsTest.php
M repo/tests/phpunit/includes/api/ItemByTitleHelperTest.php
M repo/tests/phpunit/includes/api/MergeItemsTest.php
M repo/tests/phpunit/includes/api/ResultBuilderTest.php
M repo/tests/phpunit/includes/api/SiteLinkTargetProviderTest.php
M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
M repo/tests/phpunit/includes/rdf/RdfSerializerTest.php
M repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
M repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
M repo/tests/phpunit/includes/specials/SpecialItemByTitleTest.php
M repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php
M repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php
M repo/tests/phpunit/includes/specials/SpecialPageCopyrightViewTest.php
M repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
M repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php
49 files changed, 436 insertions(+), 478 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/73/179473/1

diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php
index f17ec61..514d643 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php
@@ -129,10 +129,10 @@
-getMock();
$mock-expects( PHPUnit_Framework_TestCase::any() )
-method( 'validate' )
-   -will( PHPUnit_Framework_TestCase::returnValue( true ) 
);
+   -willReturn( true );
$mock-expects( PHPUnit_Framework_TestCase::any() )
-method( 'validateFormat' )
-   -will( PHPUnit_Framework_TestCase::returnValue( true ) 
);
+   -willReturn( true );
return $mock;
}
 
@@ -160,7 +160,7 @@
$mock = $this-getMock( 
'\Wikibase\DataModel\Entity\PropertyDataTypeLookup' );
$mock-expects( PHPUnit_Framework_TestCase::any() )
-method( 'getDataTypeIdForProperty

[MediaWiki-commits] [Gerrit] Rework and cleanup ApiWikibase and subclasses - change (mediawiki...Wikibase)

2014-12-15 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179881

Change subject: Rework and cleanup ApiWikibase and subclasses
..

Rework and cleanup ApiWikibase and subclasses

Main changes are:
* Narrow interfaces from Entity to EntityId.
* Remove hard coded lists of entity types if possible.
* Make stuff private if possible.
* Fix docs.

Change-Id: Ic506adc1145d04e3f4af8f0aa5d4b65ea0d4de28
---
M repo/includes/api/ApiWikibase.php
M repo/includes/api/EditEntity.php
M repo/includes/api/MergeItems.php
M repo/includes/api/ModifyEntity.php
M repo/includes/api/ModifyTerm.php
M repo/includes/api/SetAliases.php
M repo/includes/api/SetSiteLink.php
7 files changed, 164 insertions(+), 171 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/81/179881/1

diff --git a/repo/includes/api/ApiWikibase.php 
b/repo/includes/api/ApiWikibase.php
index 86f6b89..727cbb6 100644
--- a/repo/includes/api/ApiWikibase.php
+++ b/repo/includes/api/ApiWikibase.php
@@ -12,10 +12,10 @@
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdParser;
+use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\EditEntity;
 use Wikibase\EntityRevision;
 use Wikibase\Lib\Localizer\ExceptionLocalizer;
-use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\Lib\Store\BadRevisionException;
 use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\EntityStore;
@@ -155,14 +155,17 @@
}
 
/**
-* @param Entity $entity
+* @param EntityId|null $entityId
 *
 * @return bool
 */
-   protected function entityExists( Entity $entity ) {
-   $entityId = $entity-getId();
-   $title = $entityId === null ? null : 
$this-titleLookup-getTitleForId( $entityId );
-   return ( $title !== null  $title-exists() );
+   protected function entityExists( EntityId $entityId = null ) {
+   if ( $entityId === null ) {
+   return false;
+   }
+
+   $title = $this-titleLookup-getTitleForId( $entityId );
+   return $title !== null  $title-exists();
}
 
/**
@@ -173,29 +176,36 @@
}
 
/**
-* @see ApiBase::getAllowedParams()
+* @see ApiBase::getAllowedParams
+*
+* @return array Empty in this abstract base implementation.
 */
public function getAllowedParams() {
-   return array(
-   );
+   return array();
}
 
/**
-* @see ApiBase::needsToken()
+* @see ApiBase::needsToken
+*
+* @return string|false
 */
public function needsToken() {
return $this-isWriteMode() ? 'csrf' : false;
}
 
/**
-* @see ApiBase::getTokenSalt()
+* @see ApiBase::getTokenSalt
+*
+* @return string|false
 */
public function getTokenSalt() {
return $this-needsToken() ? '' : false;
}
 
/**
-* @see ApiBase::mustBePosted()
+* @see ApiBase::mustBePosted
+*
+* @return bool
 */
public function mustBePosted() {
return $this-isWriteMode();
@@ -203,6 +213,8 @@
 
/**
 * @see ApiBase::isReadMode
+*
+* @return bool Always true in this abstract base implementation.
 */
public function isReadMode() {
return true;
@@ -226,12 +238,11 @@
 * Per default, this will include the 'read' permission if 
$this-isReadMode() returns true,
 * and the 'edit' permission if $this-isWriteMode() returns true,
 *
-* @param Entity $entity The entity to check permissions for
-* @param array $params Arguments for the module, describing the 
operation to be performed
+* @param EntityId|null $entityId The entity to check permissions for
 *
-* @return array A list of permissions
+* @return string[] A list of permissions
 */
-   protected function getRequiredPermissions( Entity $entity, array 
$params ) {
+   protected function getRequiredPermissions( EntityId $entityId = null ) {
$permissions = array();
 
if ( $this-isReadMode() ) {
@@ -250,13 +261,12 @@
 *
 * @param $entity Entity the entity to check
 * @param $user User doing the action
-* @param $params array of arguments for the module, passed for 
ModifyItem
 *
 * @return Status the check's result
 * @todo: use this also to check for read access in ApiGetEntities, etc
 */
-   protected function checkPermissions( Entity $entity, User $user, array 
$params ) {
-   $permissions

[MediaWiki-commits] [Gerrit] Rework importInterlang/Properties maintainance scripts - change (mediawiki...Wikibase)

2014-12-15 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179915

Change subject: Rework importInterlang/Properties maintainance scripts
..

Rework importInterlang/Properties maintainance scripts

Change-Id: I0b2be11d2bbb2cc5b91c7a56b89e0a20df8149c7
---
M repo/maintenance/importInterlang.php
M repo/maintenance/importProperties.php
2 files changed, 134 insertions(+), 109 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/15/179915/1

diff --git a/repo/maintenance/importInterlang.php 
b/repo/maintenance/importInterlang.php
index 9237758..bb09af6 100644
--- a/repo/maintenance/importInterlang.php
+++ b/repo/maintenance/importInterlang.php
@@ -24,30 +24,45 @@
 
 class importInterlang extends Maintenance {
 
-   protected $verbose = false;
-   protected $ignore_errors = false;
-   protected $skip = 0;
-   protected $only = 0;
+   /**
+* @var bool
+*/
+   private $verbose = false;
+
+   /**
+* @var bool
+*/
+   private $ignoreErrors = false;
+
+   /**
+* @var int
+*/
+   private $skip = 0;
+
+   /**
+* @var int
+*/
+   private $only = 0;
 
/**
 * @var User
 */
-   protected $user = null;
+   private $user;
 
/**
 * @var EntityStore
 */
-   protected $store = null;
+   private $store;
 
public function __construct() {
-   $this-mDescription = Import interlanguage links in 
Wikidata.\n\nThe links may be created by extractInterlang.sql;
+   $this-mDescription = 'Import interlanguage links in 
Wikidata.\n\nThe links may be created by extractInterlang.sql';
 
-   $this-addOption( 'skip', Skip number of entries in the import 
file );
-   $this-addOption( 'only', Only import the specific entry from 
the import file );
-   $this-addOption( 'verbose', Print activity  );
-   $this-addOption( 'ignore-errors', Continue after errors );
-   $this-addArg( 'lang', The source wiki's language code (e.g. 
`en`), true );
-   $this-addArg( 'filename', File with interlanguage links, 
true );
+   $this-addOption( 'skip', 'Skip number of entries in the import 
file' );
+   $this-addOption( 'only', 'Only import the specific entry from 
the import file' );
+   $this-addOption( 'verbose', 'Print activity' );
+   $this-addOption( 'ignore-errors', 'Continue after errors' );
+   $this-addArg( 'lang', 'The source wiki\'s language code (e.g. 
en)', true );
+   $this-addArg( 'filename', 'File with interlanguage links', 
true );
 
parent::__construct();
}
@@ -64,31 +79,31 @@
$this-store = 
WikibaseRepo::getDefaultInstance()-getEntityStore();
 
$this-verbose = (bool)$this-getOption( 'verbose' );
-   $this-ignore_errors = (bool)$this-getOption( 'ignore-errors' 
);
+   $this-ignoreErrors = (bool)$this-getOption( 'ignore-errors' );
$this-skip = (int)$this-getOption( 'skip' );
$this-only = (int)$this-getOption( 'only' );
-   $lang = $this-getArg( 0 );
+   $languageCode = $this-getArg( 0 );
$filename = $this-getArg( 1 );
 
-   $file = fopen( $filename, r );
+   $file = fopen( $filename, 'r' );
 
if ( !$file ) {
-   $this-doPrint( ERROR: failed to open `$filename` );
+   $this-doPrint( 'ERROR: failed to open ' . $filename );
return;
}
 
fgets( $file ); // We don't need the first line with column 
names.
 
$current = null;
-   $current_links = array();
+   $currentLinks = array();
$count = 0;
$ok = true;
-   while( $link = fgetcsv( $file, 0, \t ) ) {
-   if( $link[0] !== $current ) {
-   if ( !empty( $current_links ) ) {
-   $ok = $this-createItem( $current_links 
);
+   while ( $link = fgetcsv( $file, 0, \t ) ) {
+   if ( $link[0] !== $current ) {
+   if ( !empty( $currentLinks ) ) {
+   $ok = $this-createItem( $currentLinks 
);
 
-   if ( !$ok  !$this-ignore_errors ) {
+   if ( !$ok  !$this-ignoreErrors ) {
break;
}
}
@@ -98,59 +113,57 @@
continue

[MediaWiki-commits] [Gerrit] Rework and clean up TermIndex interfaces - change (mediawiki...Wikibase)

2014-12-15 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179931

Change subject: Rework and clean up TermIndex interfaces
..

Rework and clean up TermIndex interfaces

This is a direct follow up to all my comments in Ie0d92ae. Main
reason for this patch is the removal of the redundant $entityType
parameter.

Please note that both patches (Ie0d92ae and this one) will cause
breaking changes in PropertySuggester!

Change-Id: Ibec48cf6b33017336f73463e608b88c09e718993
---
M client/includes/api/PageTerms.php
M client/tests/phpunit/includes/api/PageTermsTest.php
M lib/includes/store/TermIndex.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/tests/phpunit/store/MockTermIndex.php
M lib/tests/phpunit/store/TermIndexTest.php
M repo/includes/api/SearchEntities.php
7 files changed, 93 insertions(+), 97 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/31/179931/1

diff --git a/client/includes/api/PageTerms.php 
b/client/includes/api/PageTerms.php
index 58c252b..c77530a 100644
--- a/client/includes/api/PageTerms.php
+++ b/client/includes/api/PageTerms.php
@@ -74,7 +74,7 @@
$pagesToEntityIds = $this-getEntityIdsForTitles( $titles, 
$continue );
$entityToPageMap = $this-getEntityToPageMap( $pagesToEntityIds 
);
 
-   $terms = $this-getTermsOfEntities( $pagesToEntityIds, 
$languageCode, $params['terms'] );
+   $terms = $this-getTermsOfEntities( $pagesToEntityIds, 
$params['terms'], $languageCode );
 
$termGroups = $this-groupTermsByPageAndType( $entityToPageMap, 
$terms );
 
@@ -99,19 +99,19 @@
 
/**
 * @param EntityID[] $entityIds
-* @param string $languageCode
 * @param string[]|null $termTypes
+* @param string $languageCode
 *
 * @return Term[]
 */
-   private function getTermsOfEntities( array $entityIds, $languageCode, 
array $termTypes = null ) {
+   private function getTermsOfEntities( array $entityIds, array $termTypes 
= null, $languageCode ) {
$entityIdGroups = $this-splitPageEntityMapByType( $entityIds );
$terms = array();
 
-   foreach ( $entityIdGroups as $entityType = $entityIds ) {
+   foreach ( $entityIdGroups as $entityIds ) {
$terms = array_merge(
$terms,
-   $this-termIndex-getTermsOfEntities( 
$entityIds, $entityType, $termTypes, array( $languageCode ) )
+   $this-termIndex-getTermsOfEntities( 
$entityIds, $termTypes, array( $languageCode ) )
);
}
 
diff --git a/client/tests/phpunit/includes/api/PageTermsTest.php 
b/client/tests/phpunit/includes/api/PageTermsTest.php
index 487dc2b..2638cda 100644
--- a/client/tests/phpunit/includes/api/PageTermsTest.php
+++ b/client/tests/phpunit/includes/api/PageTermsTest.php
@@ -108,7 +108,7 @@
}
 
/**
-* @param array $terms
+* @param array[] $terms
 *
 * @return TermIndex
 */
@@ -121,14 +121,14 @@
$termObjectsByEntityId[$key] = 
$this-makeTermsFromGroups( $entityId, $termGroups );
}
 
-   $this_ = $this;
+   $self = $this;
 
$termIndex = $this-getMock( 'Wikibase\TermIndex' );
$termIndex-expects( $this-any() )
-method( 'getTermsOfEntities' )
-will( $this-returnCallback(
-   function ( array $entityIds, $entityType, 
$termTypes = null, $languages = null ) use( $termObjectsByEntityId, $this_ ) {
-   return $this_-getTermsOfEntities( 
$termObjectsByEntityId, $entityIds, $entityType, $termTypes, $languages );
+   function( array $entityIds, array $termTypes = 
null, array $languagesCodes = null ) use ( $termObjectsByEntityId, $self ) {
+   return $self-getTermsOfEntities( 
$termObjectsByEntityId, $entityIds, $termTypes, $languagesCodes );
}
) );
 
@@ -139,14 +139,14 @@
 * @note Public only because older PHP versions don't allow it to be 
called
 *   from a closure otherwise.
 *
-* @param array $termObjectsByEntityId
+* @param array[] $termObjectsByEntityId
 * @param EntityId[] $entityIds
-* @param string $entityType
-* @param string|null $language
+* @param string[]|null $termTypes
+* @param string[]|null $languageCodes
 *
 * @return Term[]
 */
-   public function getTermsOfEntities( $termObjectsByEntityId, $entityIds, 
$entityType, $termTypes, $languages ) {
+   public function

[MediaWiki-commits] [Gerrit] Drop useless docs from Store interface - change (mediawiki...Wikibase)

2014-12-15 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179937

Change subject: Drop useless docs from Store interface
..

Drop useless docs from Store interface

Some comments were wrong, must added zero additional information.

Change-Id: Id8410f75c04a303c61fd4ab0206e42d2752e94db
---
M repo/includes/store/Store.php
1 file changed, 1 insertion(+), 25 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/37/179937/1

diff --git a/repo/includes/store/Store.php b/repo/includes/store/Store.php
index e21026c..34e7104 100644
--- a/repo/includes/store/Store.php
+++ b/repo/includes/store/Store.php
@@ -26,13 +26,9 @@
 interface Store {
 
/**
-* Returns a new SiteLinkCache for this store.
-*
 * @since 0.1
 *
 * @return SiteLinkCache
-*
-* @todo: rename to newSiteLinkIndex
 */
public function newSiteLinkCache();
 
@@ -44,15 +40,13 @@
public function clear();
 
/**
-* Rebuilds the store.
+* Rebuilds the store from the original data source.
 *
 * @since 0.1
 */
public function rebuild();
 
/**
-* Returns a TermIndex for this store.
-*
 * @since 0.4
 *
 * @return TermIndex
@@ -60,8 +54,6 @@
public function getTermIndex();
 
/**
-* Returns a TermIndex for this store.
-*
 * @since 0.5
 *
 * @return LabelConflictFinder
@@ -69,8 +61,6 @@
public function getLabelConflictFinder();
 
/**
-* Returns a new IdGenerator for this store.
-*
 * @since 0.1
 *
 * @return IdGenerator
@@ -78,8 +68,6 @@
public function newIdGenerator();
 
/**
-* Return a new EntityPerPage.
-*
 * @since 0.3
 *
 * @return EntityPerPage
@@ -87,8 +75,6 @@
public function newEntityPerPage();
 
/**
-* Returns an EntityLookup
-*
 * @since 0.4
 *
 * @param string $uncached Flag string, set to 'uncached' to get an 
uncached direct lookup service.
@@ -98,8 +84,6 @@
public function getEntityLookup( $uncached = '' );
 
/**
-* Returns an EntityRevisionLookup
-*
 * @since 0.5
 *
 * @param string $uncached Flag string, set to 'uncached' to get an 
uncached direct lookup service.
@@ -109,8 +93,6 @@
public function getEntityRevisionLookup( $uncached = '' );
 
/**
-* Returns an EntityStore
-*
 * @since 0.5
 *
 * @return EntityStore
@@ -128,8 +110,6 @@
public function getEntityStoreWatcher();
 
/**
-* Returns an EntityInfoBuilder
-*
 * @since 0.5
 *
 * @return EntityInfoBuilderFactory
@@ -137,8 +117,6 @@
public function getEntityInfoBuilderFactory();
 
/**
-* Returns a PropertyInfoStore
-*
 * @since 0.4
 *
 * @return PropertyInfoStore
@@ -146,8 +124,6 @@
public function getPropertyInfoStore();
 
/**
-* Returns a ChangesTable
-*
 * @since 0.5
 *
 * @return ChangesTable

-- 
To view, visit https://gerrit.wikimedia.org/r/179937
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8410f75c04a303c61fd4ab0206e42d2752e94db
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] SpecialPage::execute doesn't return anything - change (mediawiki/core)

2014-12-15 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179950

Change subject: SpecialPage::execute doesn't return anything
..

SpecialPage::execute doesn't return anything

Change-Id: I6f413a633b71739592aae8c8b2db61ad4abc2a79
---
M includes/specials/SpecialChangeEmail.php
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/50/179950/1

diff --git a/includes/specials/SpecialChangeEmail.php 
b/includes/specials/SpecialChangeEmail.php
index 12bbd2a..4f278eb 100644
--- a/includes/specials/SpecialChangeEmail.php
+++ b/includes/specials/SpecialChangeEmail.php
@@ -39,7 +39,7 @@
/**
 * @return bool
 */
-   function isListed() {
+   public function isListed() {
global $wgAuth;
 
return $wgAuth-allowPropChange( 'emailaddress' );
@@ -54,7 +54,7 @@
$out-disallowUserJs();
$out-addModules( 'mediawiki.special.changeemail' );
 
-   return parent::execute( $par );
+   parent::execute( $par );
}
 
protected function checkExecutePermissions( User $user ) {
@@ -149,7 +149,7 @@
 * @param string $newaddr
 * @return Status
 */
-   protected function attemptChange( User $user, $pass, $newaddr ) {
+   private function attemptChange( User $user, $pass, $newaddr ) {
global $wgAuth;
 
if ( $newaddr != ''  !Sanitizer::validateEmail( $newaddr ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/179950
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f413a633b71739592aae8c8b2db61ad4abc2a79
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Stop EntityIdFormatter extending ValueFormatterBase - change (mediawiki...Wikibase)

2014-12-16 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180163

Change subject: Stop EntityIdFormatter extending ValueFormatterBase
..

Stop EntityIdFormatter extending ValueFormatterBase

ValueFormatterBase is in data-values/interfaces. This should not be
a ValueFormatter.

Warning, I have not searched for places that type hint against
ValueFormatter or ValueFormatterBase but expect an EntityIdFormatter.
Our tests should cover this, shouldn't they?

Change-Id: I7653399247bbf31ec70defeb36f4e99de14fa788
---
M lib/includes/formatters/EntityIdFormatter.php
M lib/includes/formatters/EntityIdHtmlLinkFormatter.php
M lib/includes/formatters/EntityIdTitleFormatter.php
3 files changed, 40 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/63/180163/1

diff --git a/lib/includes/formatters/EntityIdFormatter.php 
b/lib/includes/formatters/EntityIdFormatter.php
index 3571ee6..d1676cb 100644
--- a/lib/includes/formatters/EntityIdFormatter.php
+++ b/lib/includes/formatters/EntityIdFormatter.php
@@ -3,7 +3,7 @@
 namespace Wikibase\Lib;
 
 use InvalidArgumentException;
-use ValueFormatters\ValueFormatterBase;
+use ValueFormatters\FormatterOptions;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdValue;
 
@@ -14,7 +14,42 @@
  * @author Jeroen De Dauw  jeroended...@gmail.com 
  * @author Thiemo Mättig
  */
-class EntityIdFormatter extends ValueFormatterBase {
+class EntityIdFormatter {
+
+   const OPT_LANG = 'lang';
+
+   /**
+* @var FormatterOptions
+*/
+   private $options;
+
+   /**
+* @param FormatterOptions $options
+*/
+   public function __construct( FormatterOptions $options ) {
+   $this-options = $options;
+
+   $this-options-defaultOption( self::OPT_LANG, 'en' );
+   }
+
+   /**
+* Shortcut to $this-options-getOption.
+*
+* @param string $option
+*/
+   protected final function getOption( $option ) {
+   return $this-options-getOption( $option );
+   }
+
+   /**
+* Shortcut to $this-options-defaultOption.
+*
+* @param string $option
+* @param mixed $default
+*/
+   protected final function defaultOption( $option, $default ) {
+   $this-options-defaultOption( $option, $default );
+   }
 
/**
 * Format an EntityId data value
@@ -32,7 +67,7 @@
}
 
if ( !( $value instanceof EntityId ) ) {
-   throw new InvalidArgumentException( 'Data value type 
mismatch. Expected an EntityId or EntityIdValue.' );
+   throw new InvalidArgumentException( '$value must be an 
EntityId or EntityIdValue' );
}
 
return $this-formatEntityId( $value );
diff --git a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php 
b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php
index c99cebc..3e26b3e 100644
--- a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php
+++ b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php
@@ -22,7 +22,7 @@
/**
 * @var EntityTitleLookup
 */
-   protected $entityTitleLookup;
+   private $entityTitleLookup;
 
public function __construct(
FormatterOptions $options,
diff --git a/lib/includes/formatters/EntityIdTitleFormatter.php 
b/lib/includes/formatters/EntityIdTitleFormatter.php
index c18ddd7..0f625af 100644
--- a/lib/includes/formatters/EntityIdTitleFormatter.php
+++ b/lib/includes/formatters/EntityIdTitleFormatter.php
@@ -19,7 +19,7 @@
/**
 * @var EntityTitleLookup
 */
-   protected $titleLookup;
+   private $titleLookup;
 
/**
 * @param FormatterOptions $options

-- 
To view, visit https://gerrit.wikimedia.org/r/180163
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7653399247bbf31ec70defeb36f4e99de14fa788
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix minor issues in JSDoc tags - change (mediawiki...WikibaseJavaScriptApi)

2014-12-16 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180185

Change subject: Fix minor issues in JSDoc tags
..

Fix minor issues in JSDoc tags

Change-Id: I144cbcb82a4e97fa3ef505ed5c0a1adefc0e1ff8
---
M src/RepoApi.js
M tests/RepoApi.tests.js
2 files changed, 8 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseJavaScriptApi 
refs/changes/85/180185/1

diff --git a/src/RepoApi.js b/src/RepoApi.js
index f90a70c..2cada37 100644
--- a/src/RepoApi.js
+++ b/src/RepoApi.js
@@ -70,7 +70,7 @@
 * @param {String} id `Entity` id.
 * @param {Number} baseRevId Revision id the edit shall be performed on.
 * @param {Object} data The `Entity`'s structure.
-* @param {Boolean} [clear=false] Whether to clear whole entity before 
editing.
+* @param {boolean} [clear=false] Whether to clear whole entity before 
editing.
 * @return {Object} jQuery.Promise
 * @return {Function} return.done
 * @return {*} return.done.result
@@ -99,7 +99,7 @@
 * @see wikibase.api.RepoApi._post
 *
 * @param {Object} dataValue `DataValue` serialization.
-* @param {Object} [options={}]
+* @param {Object} [options]
 * @param {string} [dataType] `dataTypes.DataType` id.
 * @param {string} [outputFormat]
 * @return {Object} jQuery.Promise
@@ -113,8 +113,8 @@
formatValue: function( dataValue, options, dataType, outputFormat ) {
var params = {
action: 'wbformatvalue',
-   datavalue:  JSON.stringify( dataValue ),
-   options: JSON.stringify( options || {} )
+   datavalue: JSON.stringify( dataValue ),
+   options: JSON.stringify( options )
};
 
if( dataType ) {
@@ -607,8 +607,8 @@
 * Sets a site link for an item via the API.
 * @see wikibase.api.RepoApi._post
 *
-* @param {string} [fromId] `Entity` id to merge from.
-* @param {string} [toId] `Entity` id to merge to.
+* @param {string} fromId `Entity` id to merge from.
+* @param {string} toId `Entity` id to merge to.
 * @param {string[]|string} [ignoreConflicts] Elements of the `Item` to 
ignore conflicts for.
 * @param {string} [summary] Summary for the edit.
 * @return {Object} jQuery.Promise
diff --git a/tests/RepoApi.tests.js b/tests/RepoApi.tests.js
index e59aa83..2a2e44a 100644
--- a/tests/RepoApi.tests.js
+++ b/tests/RepoApi.tests.js
@@ -25,7 +25,7 @@
 
/**
 * Queue key naming the queue that all tests are appended to.
-* @var {String}
+* @var {string}
 */
var qkey = 'asyncTests';
 
@@ -50,7 +50,7 @@
/**
 * Handles a failing API request. (The details get logged in the 
console by mw.Api.)
 *
-* @param {String} code
+* @param {string} code
 * @param {Object} details
 */
var onFail = function( code, details ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/180185
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I144cbcb82a4e97fa3ef505ed5c0a1adefc0e1ff8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fixed creating an empty entity - change (mediawiki...WikibaseJavaScriptApi)

2014-12-16 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Fixed creating an empty entity
..


Fixed creating an empty entity

Change-Id: Ib26abf43cd8edf5412c9867d2fc30fded850d162
---
M README.md
M src/RepoApi.js
2 files changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index 8c60801..57088c8 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,9 @@
  Enhancements
 * Updated code documentation to be able to generate documentation using JSDuck.
 
+### Bugfixes
+* An empty `Entity` may be created by omitting the `data` parameter on 
`wikibase.api.RepoApi.createEntity()` again.
+
 ### 1.0.1 (2014-11-28)
 
 * Bump the data-values/javascript dependency to 0.6.0 so that it matches 
Wikibase.git's.
diff --git a/src/RepoApi.js b/src/RepoApi.js
index f90a70c..d688ca8 100644
--- a/src/RepoApi.js
+++ b/src/RepoApi.js
@@ -45,7 +45,7 @@
 * @see wikibase.api.RepoApi._post
 *
 * @param {string} type The type of the `Entity` that should be created.
-* @param {Object} [data] The `Entity` data (may be omitted to create 
an empty `Entity`).
+* @param {Object} [data={}] The `Entity` data (may be omitted to 
create an empty `Entity`).
 * @return {Object} jQuery.Promise
 * @return {Function} return.done
 * @return {*} return.done.result
@@ -57,8 +57,8 @@
createEntity: function( type, data ) {
var params = {
action: 'wbeditentity',
-   data: JSON.stringify( data ),
-   'new': type
+   'new': type,
+   data: JSON.stringify( data || {} )
};
return this._post( params );
},

-- 
To view, visit https://gerrit.wikimedia.org/r/177502
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib26abf43cd8edf5412c9867d2fc30fded850d162
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/WikibaseJavaScriptApi
Gerrit-Branch: master
Gerrit-Owner: Henning Snater henning.sna...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Updated code documentation - change (mediawiki...WikibaseJavaScriptApi)

2014-12-16 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Updated code documentation
..


Updated code documentation

Updated code documentation to be able to generate documentation using JSDuck.
Includes resetting @since tags to 1.0.

Change-Id: I8d08e17970faec48565b1af6683594301725d41f
---
M .jshintrc
M README.md
M WikibaseJavaScriptApi.php
M src/FormatValueCaller.js
M src/ParseValueCaller.js
M src/RepoApi.js
M src/RepoApiError.js
M src/getLocationAgnosticMwApi.js
M src/namespace.js
9 files changed, 463 insertions(+), 300 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/.jshintrc b/.jshintrc
index a5afa4d..832d316 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -48,7 +48,6 @@
 
browser   : true, // Standard browser globals e.g. `window`, 
`document`.
 
-   indent: 4,
quotmark: false,
maxlen: 100,
maxparams: 7,
diff --git a/README.md b/README.md
index eb9ac81..8c60801 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,11 @@
 
 ## Release notes
 
+### 1.0.2 (dev)
+
+ Enhancements
+* Updated code documentation to be able to generate documentation using JSDuck.
+
 ### 1.0.1 (2014-11-28)
 
 * Bump the data-values/javascript dependency to 0.6.0 so that it matches 
Wikibase.git's.
diff --git a/WikibaseJavaScriptApi.php b/WikibaseJavaScriptApi.php
index 25a9fa4..301bd19 100644
--- a/WikibaseJavaScriptApi.php
+++ b/WikibaseJavaScriptApi.php
@@ -1,6 +1,6 @@
 ?php
 
-define( 'WIKIBASE_JAVASCRIPT_API_VERSION', '1.0.1' );
+define( 'WIKIBASE_JAVASCRIPT_API_VERSION', '1.0.2-dev' );
 
 if ( defined( 'MEDIAWIKI' ) ) {
call_user_func( function() {
diff --git a/src/FormatValueCaller.js b/src/FormatValueCaller.js
index 0f44558..21060ac 100644
--- a/src/FormatValueCaller.js
+++ b/src/FormatValueCaller.js
@@ -1,13 +1,14 @@
-/**
- * @licence GNU GPL v2+
- * @author H. Snater  mediaw...@snater.com 
- */
 ( function( wb, $ ) {
'use strict';
 
var MODULE = wb.api;
 
/**
+* @class wikibase.api.FormatValueCaller
+* @since 1.0
+* @licence GNU GPL v2+
+* @author H. Snater  mediaw...@snater.com 
+*
 * @constructor
 *
 * @param {wikibase.api.RepoApi} api
@@ -21,30 +22,36 @@
$.extend( SELF.prototype, {
 
/**
-* @type {wikibase.api.RepoApi}
+* @property {wikibase.api.RepoApi}
+* @private
 */
_api: null,
 
/**
-* @type {dataTypes.DataTypeStore}
+* @property {dataTypes.DataTypeStore}
+* @private
 */
_dataTypeStore: null,
 
/**
 * Makes a request to the API to format values on the server 
side. Will return a
-* jQuery.Promise which will be resolved if formatting is 
successful or rejected if it fails
-* or the API cannot be reached.
-* @since 0.5
+* `jQuery.Promise` which will be resolved if formatting is 
successful or rejected if it
+* fails or the API cannot be reached.
 *
 * @param {dataValues.DataValue} dataValue
-* @param {string} [dataType]
-* @param {string} [outputFormat]
+* @param {string|Object} [dataType] `DataType` id.
+*Assumed to be `outputFormat` if the `dataTypeStore` 
the `FormatValueCaller` has
+*been initialized with, does not contain a data type 
whose id matches the string
+*supplied via this argument.
+*Assumed to be `options` if {Object} and no additional 
arguments are provided.
+* @param {string|Object} [outputFormat]
+*Assumed to be `options` if {Object} and no additional 
arguments are provided.
 * @param {Object} [options]
-* @return {jQuery.Promise}
-* Resolved parameters:
-* - {string} Formatted DataValue.
-* Rejected parameters:
-* - {wikibase.api.RepoApiError}
+* @return {Object} jQuery.Promise
+* @return {Function} return.done
+* @return {string} return.done.formattedValue Formatted 
`DataValue`.
+* @return {Function} return.fail
+* @return {wikibase.api.RepoApiError} error
 */
formatValue: function( dataValue, dataType, outputFormat, 
options ) {
 
diff --git a/src/ParseValueCaller.js b/src/ParseValueCaller.js
index 01f06b4..aa26af2 100644
--- a/src/ParseValueCaller.js
+++ b/src/ParseValueCaller.js
@@ -1,8 +1,3 @@
-/**
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw

[MediaWiki-commits] [Gerrit] Clean up and refactor TemplateFactory introduction - change (mediawiki...Wikibase)

2014-12-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180498

Change subject: Clean up and refactor TemplateFactory introduction
..

Clean up and refactor TemplateFactory introduction

Main functional changes are:
* TemplateFactory constructor parameter does have a default value now.
* Renamed TemplateFactory::getTemplate to get.
* Renamed TemplateFactory::renderTpl to render.
* Added constructor to TemplateRegistry.

Other changes:
* Use the same parameter order everywhere.
* Made some related type hints more specific, e.g. string[].
* Added some missing PHPDoc tags.

Change-Id: Id47127f6e77e49d02d6a48f74160d0fbe60facd6
---
M repo/Wikibase.hooks.php
M repo/includes/Template/TemplateFactory.php
M repo/includes/TemplateRegistry.php
M repo/includes/View/ClaimHtmlGenerator.php
M repo/includes/View/ClaimsView.php
M repo/includes/View/EntityView.php
M repo/includes/View/EntityViewFactory.php
M repo/includes/View/EntityViewPlaceholderExpander.php
M repo/includes/View/FingerprintView.php
M repo/includes/View/PropertyView.php
M repo/includes/View/SectionEditLinkGenerator.php
M repo/includes/View/SiteLinksView.php
M repo/includes/View/SnakHtmlGenerator.php
M repo/includes/View/TermBoxView.php
M repo/includes/WikibaseRepo.php
M repo/includes/specials/SpecialGoToLinkedPage.php
M repo/tests/phpunit/TemplateRegistryTest.php
M repo/tests/phpunit/includes/View/ClaimHtmlGeneratorTest.php
M repo/tests/phpunit/includes/View/ClaimsViewTest.php
M repo/tests/phpunit/includes/View/EntityViewFactoryTest.php
M repo/tests/phpunit/includes/View/EntityViewPlaceholderExpanderTest.php
M repo/tests/phpunit/includes/View/FingerprintViewTest.php
M repo/tests/phpunit/includes/View/ItemViewTest.php
M repo/tests/phpunit/includes/View/PropertyViewTest.php
M repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/View/SnakHtmlGeneratorTest.php
M repo/tests/phpunit/includes/View/TermBoxViewTest.php
28 files changed, 159 insertions(+), 157 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/98/180498/1

diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index 343a256..92aea79 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -992,7 +992,7 @@
$injector = new TextInjector( $placeholders );
$userLanguageLookup = new UserLanguageLookup();
$expander = new EntityViewPlaceholderExpander(
-   new TemplateFactory( 
TemplateRegistry::getDefaultInstance() ),
+   new TemplateFactory(),
$out-getTitle(),
$out-getUser(),
$out-getLanguage(),
diff --git a/repo/includes/Template/TemplateFactory.php 
b/repo/includes/Template/TemplateFactory.php
index 6fdcdf4..290faee 100644
--- a/repo/includes/Template/TemplateFactory.php
+++ b/repo/includes/Template/TemplateFactory.php
@@ -17,19 +17,20 @@
private $templateRegistry;
 
/**
-* @param TemplateRegistry $templateRegistry
+* @param TemplateRegistry|null $templateRegistry
 */
-   public function __construct(TemplateRegistry $templateRegistry) {
-   $this-templateRegistry = $templateRegistry;
+   public function __construct( TemplateRegistry $templateRegistry = null 
) {
+   $this-templateRegistry = $templateRegistry ?: 
TemplateRegistry::getDefaultInstance();
}
 
/**
 * @param string $key
 * @param array $params
+*
 * @return Template
 */
-   public function getTemplate($key, array $params) {
-   return new Template($this-templateRegistry, $key, $params);
+   public function get( $key, array $params ) {
+   return new Template( $this-templateRegistry, $key, $params );
}
 
/**
@@ -45,7 +46,7 @@
 *
 * @return string
 */
-   public function renderTpl( $key /* ... */ ) {
+   public function render( $key /* ... */ ) {
$params = func_get_args();
array_shift( $params );
 
@@ -53,7 +54,7 @@
$params = $params[0];
}
 
-   $template = $this-getTemplate($key, $params);
+   $template = $this-get( $key, $params );
 
return $template-render();
}
diff --git a/repo/includes/TemplateRegistry.php 
b/repo/includes/TemplateRegistry.php
index 33a326e..b7bd4be 100644
--- a/repo/includes/TemplateRegistry.php
+++ b/repo/includes/TemplateRegistry.php
@@ -12,32 +12,39 @@
  *
  * @licence GNU GPL v2+
  * @author H. Snater mediaw...@snater.com
+ * @author Thiemo Mättig
  */
 class TemplateRegistry

[MediaWiki-commits] [Gerrit] Replaced caseInsensitive option - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172675

Change subject: Replaced caseInsensitive option
..

Replaced caseInsensitive option

See https://github.com/wmde/ValueView/pull/131

Change-Id: Ib6052b55a37a7766d23edd50c09e865413c97da4
---
M lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/75/172675/1

diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
index 37c6a3b..2df89e0 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.entityselector.js
@@ -25,10 +25,10 @@
  * Number of results to query the API for.
  * Default value: null (will pick limit specified server-side)
  *
- * @option {boolean} caseInsensitive
+ * @option {boolean} caseSensitive
  * Whether the widget shall consider letter case when determining if 
the first suggestion
  * matches with the current input triggering the select mechanism.
- * Default: true
+ * Default: false
  *
  * @option {number} timeout
  * Default AJAX timeout in milliseconds.
@@ -99,7 +99,7 @@
language: ( IS_MW_CONTEXT ) ? mw.config.get( 
'wgUserLanguage' ) : null,
type: 'item',
limit: null,
-   caseInsensitive: true,
+   caseSensitive: false,
timeout: 8000,
messages: {
'aliases-label': mwMsgOrString( 
'wikibase-aliases-label', 'also known as:' ),
@@ -163,7 +163,7 @@
 
if(
suggestions[0].label === 
requestTerm
-   || self.options.caseInsensitive
+   || !self.options.caseSensitive
 
suggestions[0].label.toLowerCase() === requestTerm.toLowerCase()
) {
self._select( suggestions[0] );
@@ -314,7 +314,7 @@
 !( item instanceof 
$.ui.ooMenu.CustomItem )
) {
if(
-   self.options.caseInsensitive
+   !self.options.caseSensitive
 
item.getValue().toLowerCase() === self._term.toLowerCase()
) {
self._term = item.getValue();

-- 
To view, visit https://gerrit.wikimedia.org/r/172675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6052b55a37a7766d23edd50c09e865413c97da4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add missing method visibility everywhere - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172678

Change subject: Add missing method visibility everywhere
..

Add missing method visibility everywhere

Change-Id: Icac00c94f43fbc202e39c613ae2b32e07894a91c
---
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
M client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
M lib/includes/Validators/ValidatorErrorLocalizer.php
M lib/includes/formatters/EscapingValueFormatter.php
M lib/includes/formatters/MessageSnakFormatter.php
M lib/includes/store/EntityContentDataCodec.php
M repo/includes/Localizer/MessageParameterFormatter.php
M repo/includes/Validators/LabelUniquenessValidator.php
M repo/includes/Validators/SiteLinkUniquenessValidator.php
M repo/includes/Validators/TermValidatorFactory.php
M repo/tests/phpunit/includes/EditEntityTest.php
M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
M repo/tests/phpunit/includes/actions/ActionTestCase.php
M repo/tests/phpunit/includes/api/EditPageTest.php
M repo/tests/phpunit/includes/api/MergeItemsTest.php
M repo/tests/phpunit/includes/content/EntityContentTest.php
17 files changed, 33 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/78/172678/1

diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
index a87eda4..fc39ec9 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
@@ -20,9 +20,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseEntityLibraryTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 'LuaWikibaseEntityLibraryTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseEntityLibraryTests' = __DIR__ . 
'/LuaWikibaseEntityLibraryTests.lua',
);
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
index b158e8c..4ab0759 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
@@ -18,9 +18,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 
'LuaWikibaseLibraryNoArbitraryAccessTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseLibraryNoArbitraryAccessTests' = __DIR__ . 
'/LuaWikibaseLibraryNoArbitraryAccessTests.lua',
);
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
index bba0a7f..0f26d3b 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
@@ -21,9 +21,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseLibraryTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 'LuaWikibaseLibraryTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseLibraryTests' = __DIR__ . 
'/LuaWikibaseLibraryTests.lua',
);
diff --git a/lib/includes/Validators/ValidatorErrorLocalizer.php 
b/lib/includes/Validators/ValidatorErrorLocalizer.php
index 2022321..daea4da 100644
--- a/lib/includes/Validators/ValidatorErrorLocalizer.php
+++ b/lib/includes/Validators/ValidatorErrorLocalizer.php
@@ -27,7 +27,7 @@
 * parameters. MUST return wikitext. This is typically some kind of 
dispatcher. If not
 * provided, naive formatting will be used, which will fail on 
non-primitive parameters.
 */
-   function __construct( ValueFormatter $paramFormatter = null ) {
+   public function __construct( ValueFormatter $paramFormatter = null ) {
$this-paramFormatter = $paramFormatter;
}
 
diff --git a/lib/includes/formatters

[MediaWiki-commits] [Gerrit] Fix visibility of setUp/tearDown - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172679

Change subject: Fix visibility of setUp/tearDown
..

Fix visibility of setUp/tearDown

Change-Id: Idf44d31cf686ffbf67e0cd304ed4bcdd1c5af9bd
---
M client/tests/phpunit/includes/ChangeHandlerTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
M client/tests/phpunit/includes/Usage/Sql/UsageTableUpdaterTest.php
M client/tests/phpunit/includes/api/ApiClientInfoTest.php
M client/tests/phpunit/includes/recentchanges/ChangeLineFormatterTest.php
M client/tests/phpunit/includes/recentchanges/RecentChangesFilterOptionsTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
M lib/tests/phpunit/MockRepositoryTest.php
M lib/tests/phpunit/changes/ChangeRowTest.php
M lib/tests/phpunit/specials/SpecialPageTestBase.php
M lib/tests/phpunit/store/PropertyInfoTableTest.php
M lib/tests/phpunit/store/SiteLinkTableTest.php
M lib/tests/phpunit/store/SqlEntityInfoBuilderTest.php
M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
M repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
M repo/tests/phpunit/includes/ItemMoveTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataUriManagerTest.php
M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/actions/ActionTestCase.php
M repo/tests/phpunit/includes/actions/ViewEntityActionTest.php
M repo/tests/phpunit/includes/api/AvailableBadgesTest.php
M repo/tests/phpunit/includes/api/BotEditTest.php
M repo/tests/phpunit/includes/api/CreateRedirectModuleTest.php
M repo/tests/phpunit/includes/api/IntegrationApiTest.php
M repo/tests/phpunit/includes/api/LinkTitlesTest.php
M repo/tests/phpunit/includes/api/MergeItemsTest.php
M repo/tests/phpunit/includes/api/ModifyTermTestCase.php
M repo/tests/phpunit/includes/api/ParseValueTest.php
M repo/tests/phpunit/includes/api/PermissionsTestCase.php
M repo/tests/phpunit/includes/api/SearchEntitiesTest.php
M repo/tests/phpunit/includes/api/SetAliasesTest.php
M repo/tests/phpunit/includes/api/SetClaimValueTest.php
M repo/tests/phpunit/includes/api/SetDescriptionTest.php
M repo/tests/phpunit/includes/api/SetLabelTest.php
M repo/tests/phpunit/includes/api/SetQualifierTest.php
M repo/tests/phpunit/includes/content/ItemContentTest.php
M repo/tests/phpunit/includes/specials/SpecialItemsWithoutSitelinksTest.php
M repo/tests/phpunit/includes/specials/SpecialListDatatypesTest.php
M repo/tests/phpunit/includes/specials/SpecialMergeItemsTest.php
M repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
46 files changed, 52 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/79/172679/1

diff --git a/client/tests/phpunit/includes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/ChangeHandlerTest.php
index ff07189..88f1c5a 100644
--- a/client/tests/phpunit/includes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/ChangeHandlerTest.php
@@ -44,7 +44,7 @@
/** @var Site $site */
protected $site;
 
-   public function setUp() {
+   protected function setUp() {
parent::setUp();
 
$this-site = new \MediaWikiSite();
diff --git a/client/tests/phpunit/includes/LangLinkHandlerTest.php 
b/client/tests/phpunit/includes/LangLinkHandlerTest.php
index 2550958..7d7135b 100644
--- a/client/tests/phpunit/includes/LangLinkHandlerTest.php
+++ b/client/tests/phpunit/includes/LangLinkHandlerTest.php
@@ -60,7 +60,7 @@
return $items;
}
 
-   public function setUp() {
+   protected function setUp() {
parent::setUp();
 
$this-langLinkHandler = $this-getLangLinkHandler( array() );
diff --git a/client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php 
b/client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
index 1bc0cf8..f332d6b 100644
--- a/client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
+++ b/client/tests/phpunit/includes/Usage/Sql/SqlUsageTrackerTest.php
@@ -37,7 +37,7 @@
 */
private $lookupTester;
 
-   public function setUp() {
+   protected function setUp() {
if ( 
WikibaseClient::getDefaultInstance()-getSettings()-getSetting( 
'useLegacyUsageIndex' ) ) {
$this-markTestSkipped( 'Skipping test for 
SqlUsageTracker, because the useLegacyUsageIndex option is set.' );
}
diff --git a/client

[MediaWiki-commits] [Gerrit] Fix visibility of setUp/tearDown - change (mediawiki...Scribunto)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172688

Change subject: Fix visibility of setUp/tearDown
..

Fix visibility of setUp/tearDown

Required for Idf44d31.

Change-Id: If6d270549290bed2d1c7617da0fedbd385f3e96c
---
M tests/engines/LuaCommon/CommonTest.php
M tests/engines/LuaCommon/HtmlLibraryTest.php
M tests/engines/LuaCommon/LuaEngineTestBase.php
M tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php
M tests/engines/LuaCommon/LuaInterpreterTest.php
M tests/engines/LuaCommon/SiteLibraryTest.php
M tests/engines/LuaCommon/TextLibraryTest.php
M tests/engines/LuaCommon/TitleLibraryTest.php
M tests/engines/LuaCommon/UriLibraryTest.php
M tests/engines/LuaCommon/UstringLibraryPureLuaTest.php
M tests/engines/LuaCommon/UstringLibraryTest.php
M tests/engines/LuaStandalone/StandaloneTest.php
12 files changed, 25 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/88/172688/1

diff --git a/tests/engines/LuaCommon/CommonTest.php 
b/tests/engines/LuaCommon/CommonTest.php
index 4caaf51..19504f7 100644
--- a/tests/engines/LuaCommon/CommonTest.php
+++ b/tests/engines/LuaCommon/CommonTest.php
@@ -40,7 +40,7 @@
'_VERSION',
);
 
-   function setUp() {
+   protected function setUp() {
parent::setUp();
 
// Register libraries for self::testPHPLibrary()
diff --git a/tests/engines/LuaCommon/HtmlLibraryTest.php 
b/tests/engines/LuaCommon/HtmlLibraryTest.php
index bb027e4..5b47962 100644
--- a/tests/engines/LuaCommon/HtmlLibraryTest.php
+++ b/tests/engines/LuaCommon/HtmlLibraryTest.php
@@ -3,7 +3,7 @@
 class Scribunto_LuaHtmlLibraryTests extends Scribunto_LuaEngineTestBase {
protected static $moduleName = 'HtmlLibraryTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'HtmlLibraryTests' = __DIR__ . '/HtmlLibraryTests.lua',
);
diff --git a/tests/engines/LuaCommon/LuaEngineTestBase.php 
b/tests/engines/LuaCommon/LuaEngineTestBase.php
index e2c62f4..e7721b4 100644
--- a/tests/engines/LuaCommon/LuaEngineTestBase.php
+++ b/tests/engines/LuaCommon/LuaEngineTestBase.php
@@ -148,7 +148,7 @@
return $suite;
}
 
-   function tearDown() {
+   protected function tearDown() {
if ( $this-luaDataProvider ) {
$this-luaDataProvider-destroy();
$this-luaDataProvider = null;
@@ -172,7 +172,7 @@
/**
 * @return ScribuntoEngineBase
 */
-   function getEngine() {
+   private function getEngine() {
if ( !$this-engine ) {
$parser = new Parser;
$options = new ParserOptions;
@@ -188,7 +188,7 @@
return $this-engine;
}
 
-   function templateCallback( $title, $parser ) {
+   private function templateCallback( $title, $parser ) {
if ( isset($this-extraModules[$title-getFullText()]) ) {
return array(
'text' = 
$this-extraModules[$title-getFullText()],
@@ -211,7 +211,7 @@
return Parser::statelessFetchTemplate( $title, $parser );
}
 
-   function toString() {
+   public function toString() {
// When running tests written in Lua, return a nicer 
representation in
// the failure message.
if ( $this-luaTestName ) {
@@ -220,13 +220,13 @@
return $this-engineName . ': ' . parent::toString();
}
 
-   function getTestModules() {
+   protected function getTestModules() {
return array(
'TestFramework' = __DIR__ . '/TestFramework.lua',
);
}
 
-   function provideLuaData() {
+   public function provideLuaData() {
if ( !$this-luaDataProvider ) {
$class = static::$dataProviderClass;
$this-luaDataProvider = new $class ( 
$this-getEngine(), static::$moduleName );
@@ -235,7 +235,7 @@
}
 
/** @dataProvider provideLuaData */
-   function testLua( $key, $testName, $expected ) {
+   public function testLua( $key, $testName, $expected ) {
$this-luaTestName = static::$moduleName.[$key]: $testName;
if ( isset( $this-skipTests[$testName] ) ) {
$this-markTestSkipped( $this-skipTests[$testName] );
diff --git a/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php 
b/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php
index 196e4a8..6921cf5 100644
--- a/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php
+++ b/tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php

[MediaWiki-commits] [Gerrit] Add missing visibility keywords everywhere - change (mediawiki...Scribunto)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172691

Change subject: Add missing visibility keywords everywhere
..

Add missing visibility keywords everywhere

Change-Id: I270d1dd9b6545e15398c2f8b8e9ae533844cc998
---
M common/Base.php
M tests/engines/LuaCommon/CommonTest.php
M tests/engines/LuaCommon/LanguageLibraryTest.php
M tests/engines/LuaCommon/LuaEngineTestBase.php
M tests/engines/LuaCommon/LuaEnvironmentComparisonTest.php
M tests/engines/LuaCommon/LuaInterpreterTest.php
M tests/engines/LuaCommon/MessageLibraryTest.php
M tests/engines/LuaCommon/TitleLibraryTest.php
M tests/engines/LuaCommon/UstringLibraryTest.php
M tests/engines/LuaSandbox/LuaSandboxInterpreterTest.php
M tests/engines/LuaSandbox/SandboxTest.php
M tests/engines/LuaStandalone/LuaStandaloneInterpreterTest.php
12 files changed, 44 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/91/172691/1

diff --git a/common/Base.php b/common/Base.php
index 1fbf945..850cb44 100644
--- a/common/Base.php
+++ b/common/Base.php
@@ -91,7 +91,7 @@
}
}
 
-   function __destruct() {
+   public function __destruct() {
$this-destroy();
}
 
diff --git a/tests/engines/LuaCommon/CommonTest.php 
b/tests/engines/LuaCommon/CommonTest.php
index 19504f7..5ccce8b 100644
--- a/tests/engines/LuaCommon/CommonTest.php
+++ b/tests/engines/LuaCommon/CommonTest.php
@@ -71,7 +71,7 @@
);
}
 
-   function getTestModules() {
+   public function getTestModules() {
return parent::getTestModules() + array(
'CommonTests' = __DIR__ . '/CommonTests.lua',
'CommonTests-data' = __DIR__ . '/CommonTests-data.lua',
@@ -83,7 +83,7 @@
);
}
 
-   function testNoLeakedGlobals() {
+   public function testNoLeakedGlobals() {
$interpreter = $this-getEngine()-getInterpreter();
 
list( $actualGlobals ) = $interpreter-callFunction(
@@ -99,7 +99,7 @@
);
}
 
-   function testPHPLibrary() {
+   public function testPHPLibrary() {
$engine = $this-getEngine();
$frame = $engine-getParser()-getPreprocessor()-newFrame();
 
@@ -191,7 +191,7 @@
'library is not recreated between invokes' );
}
 
-   function testModuleStringExtend() {
+   public function testModuleStringExtend() {
$engine = $this-getEngine();
$interpreter = $engine-getInterpreter();
 
@@ -265,7 +265,7 @@
);
}
 
-   function testLoadDataLoadedOnce() {
+   public function testLoadDataLoadedOnce() {
$engine = $this-getEngine();
$interpreter = $engine-getInterpreter();
$frame = $engine-getParser()-getPreprocessor()-newFrame();
@@ -311,7 +311,7 @@
);
}
 
-   function testFrames() {
+   public function testFrames() {
$engine = $this-getEngine();
 
$ret = $engine-runConsole( array(
@@ -342,7 +342,7 @@
$this-assertSame( ok\ttable, $ret['return'], 'child frames 
have correct parents' );
}
 
-   function testCallParserFunction() {
+   public function testCallParserFunction() {
global $wgContLang;
 
$engine = $this-getEngine();
@@ -471,7 +471,7 @@
}
}
 
-   function testBug62291() {
+   public function testBug62291() {
$engine = $this-getEngine();
$frame = $engine-getParser()-getPreprocessor()-newFrame();
 
@@ -514,7 +514,7 @@
$this-assertSame( $r1, $r2, 'Multiple invokes with recursive 
invoke returned different sets of random numbers' );
}
 
-   function testOsDateTimeTTLs() {
+   public function testOsDateTimeTTLs() {
$engine = $this-getEngine();
$pp = $engine-getParser()-getPreprocessor();
 
@@ -587,7 +587,7 @@
/**
 * @dataProvider provideVolatileCaching
 */
-   function testVolatileCaching( $func ) {
+   public function testVolatileCaching( $func ) {
$engine = $this-getEngine();
$parser = $engine-getParser();
$pp = $parser-getPreprocessor();
@@ -626,7 +626,7 @@
$this-assertEquals( '1 2', $text, Volatile wikitext was not 
cached );
}
 
-   function provideVolatileCaching() {
+   public function provideVolatileCaching() {
return array(
array( 'preprocess' ),
array( 'extensionTag' ),
@@ -634,7 +634,7 @@
);
}
 
-   function testGetCurrentFrameAndMWLoadData() {
+   public function

[MediaWiki-commits] [Gerrit] Unify top factory getter implementations - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172703

Change subject: Unify top factory getter implementations
..

Unify top factory getter implementations

The fact that the variables can be null should be documented in my
opinion.

The fact that they are null by default should be written down
explicitely, in my opinion.

The check should be done with === null, in my opinion, not with
! (it's not a bool) and not with isset.

Change-Id: Ib5bb23de7b32b03706ea8126434b05b35efdf9da
---
M client/includes/WikibaseClient.php
M repo/includes/WikibaseRepo.php
2 files changed, 77 insertions(+), 72 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/03/172703/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 5161ee8..fcd51e0 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -65,11 +65,6 @@
 final class WikibaseClient {
 
/**
-* @var PropertyDataTypeLookup
-*/
-   public $propertyDataTypeLookup;
-
-   /**
 * @var SettingsArray
 */
private $settings;
@@ -80,62 +75,67 @@
private $contentLanguage;
 
/**
-* @var DataTypeFactory
+* @var SiteStore|null
+*/
+   private $siteStore = null;
+
+   /**
+* @var DataTypeFactory|null
 */
private $dataTypeFactory = null;
 
/**
-* @var EntityIdParser
+* @var EntityIdParser|null
 */
private $entityIdParser = null;
 
/**
-* @var LanguageFallbackChainFactory
+* @var PropertyDataTypeLookup|null
+*/
+   public $propertyDataTypeLookup = null;
+
+   /**
+* @var LanguageFallbackChainFactory|null
 */
private $languageFallbackChainFactory = null;
 
/**
-* @var ClientStore
+* @var ClientStore|null
 */
private $store = null;
 
/**
-* @var StringNormalizer
+* @var StringNormalizer|null
 */
-   private $stringNormalizer;
+   private $stringNormalizer = null;
 
/**
-* @var Site
+* @var Site|null
 */
private $site = null;
 
/**
-* @var string
+* @var string|null
 */
private $siteGroup = null;
 
/**
-* @var OutputFormatSnakFormatterFactory
+* @var OutputFormatSnakFormatterFactory|null
 */
-   private $snakFormatterFactory;
+   private $snakFormatterFactory = null;
 
/**
-* @var OutputFormatValueFormatterFactory
+* @var OutputFormatValueFormatterFactory|null
 */
-   private $valueFormatterFactory;
+   private $valueFormatterFactory = null;
 
/**
-* @var SiteStore
-*/
-   private $siteStore;
-
-   /**
-* @var LangLinkHandler
+* @var LangLinkHandler|null
 */
private $langLinkHandler = null;
 
/**
-* @var NamespaceChecker
+* @var NamespaceChecker|null
 */
private $namespaceChecker = null;
 
@@ -144,7 +144,7 @@
 *
 * @param SettingsArray $settings
 * @param Language $contentLanguage
-* @param SiteStore $siteStore
+* @param SiteStore|null $siteStore
 */
public function __construct(
SettingsArray $settings,
@@ -268,12 +268,11 @@
 * @return ClientStore
 */
public function getStore() {
-   // NOTE: $repoDatabase is null per default, meaning no direct 
access to the repo's database.
-   // If $repoDatabase is false, the local wiki IS the repository.
-   // Otherwise, $repoDatabase needs to be a logical database name 
that LBFactory understands.
-   $repoDatabase = $this-settings-getSetting( 'repoDatabase' );
-
if ( $this-store === null ) {
+   // NOTE: $repoDatabase is null per default, meaning no 
direct access to the repo's
+   // database. If $repoDatabase is false, the local wiki 
IS the repository. Otherwise,
+   // $repoDatabase needs to be a logical database name 
that LBFactory understands.
+   $repoDatabase = $this-settings-getSetting( 
'repoDatabase' );
$this-store = new DirectSqlStore(
$this-getEntityContentDataCodec(),
$this-getContentLanguage(),
@@ -439,7 +438,7 @@
 * @return string
 */
public function getSiteGroup() {
-   if ( !$this-siteGroup ) {
+   if ( $this-siteGroup === null ) {
$this-siteGroup = $this-newSiteGroup();
}
 
@@ -453,7 +452,7 @@
 * @return

[MediaWiki-commits] [Gerrit] Fix visibility issues in Scribunto tests - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172709

Change subject: Fix visibility issues in Scribunto tests
..

Fix visibility issues in Scribunto tests

This needs If6d2705 to be merged first.

Change-Id: I1f71d9d4b42518bdc2ab4bd35b39793c36438dd3
---
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
M client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
4 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/09/172709/1

diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
index a87eda4..fc39ec9 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
@@ -20,9 +20,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseEntityLibraryTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 'LuaWikibaseEntityLibraryTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseEntityLibraryTests' = __DIR__ . 
'/LuaWikibaseEntityLibraryTests.lua',
);
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
index b158e8c..4ab0759 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
@@ -18,9 +18,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 
'LuaWikibaseLibraryNoArbitraryAccessTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseLibraryNoArbitraryAccessTests' = __DIR__ . 
'/LuaWikibaseLibraryNoArbitraryAccessTests.lua',
);
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
index bba0a7f..0f26d3b 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
@@ -21,9 +21,10 @@
  * @author Marius Hoch  h...@online.de 
  */
 class Scribunto_LuaWikibaseLibraryTest extends 
Scribunto_LuaWikibaseLibraryTestCase {
+
protected static $moduleName = 'LuaWikibaseLibraryTests';
 
-   function getTestModules() {
+   protected function getTestModules() {
return parent::getTestModules() + array(
'LuaWikibaseLibraryTests' = __DIR__ . 
'/LuaWikibaseLibraryTests.lua',
);
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
index 34b2876..b25f94b 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
@@ -100,7 +100,7 @@
parent::setUp();
}
 
-   public function tearDown() {
+   protected function tearDown() {
parent::tearDown();
 
$wikibaseClient = WikibaseClient::getDefaultInstance( 'reset' );

-- 
To view, visit https://gerrit.wikimedia.org/r/172709
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1f71d9d4b42518bdc2ab4bd35b39793c36438dd3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Move all client tests to Wikibase\Client\Tests - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172711

Change subject: Move all client tests to Wikibase\Client\Tests
..

Move all client tests to Wikibase\Client\Tests

Change-Id: If6c96e0b142c47ee91aa5034afb56d79ccdf854d
---
M client/includes/Changes/ChangeHandler.php
M client/includes/Changes/PageUpdater.php
M client/includes/Changes/WikiPageUpdater.php
M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/InterwikiSorterTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M client/tests/phpunit/includes/NamespaceCheckerTest.php
M client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
M client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
M client/tests/phpunit/includes/RepoLinkerTest.php
M client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
M client/tests/phpunit/includes/UpdateRepoOnMoveTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
14 files changed, 47 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/11/172711/1

diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index 5ff4576..6b11c1b 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -2,12 +2,11 @@
 
 namespace Wikibase\Client\Changes;
 
+use Exception;
 use InvalidArgumentException;
 use MWException;
 use Title;
 use Wikibase\Change;
-use Wikibase\Client\Changes\AffectedPagesFinder;
-use Wikibase\Client\Changes\PageUpdater;
 use Wikibase\DataModel\Entity\Diff\EntityDiff;
 use Wikibase\DataModel\Entity\Diff\ItemDiff;
 use Wikibase\EntityChange;
@@ -310,7 +309,7 @@
 
$currentRun[] = $change;
// skip any change that failed to process in some way 
(bug 49417)
-   } catch ( \Exception $e ) {
+   } catch ( Exception $e ) {
wfLogWarning( __METHOD__ . ':' . 
$e-getMessage() );
}
}
@@ -349,7 +348,7 @@
$coalesced = array_merge( $coalesced, $entityChanges );
}
 
-   usort( $coalesced, 
'Wikibase\Client\Changes\ChangeHandler::compareChangesByTimestamp' );
+   usort( $coalesced, array( $this, 'compareChangesByTimestamp' ) 
);
 
wfDebugLog( __CLASS__, __METHOD__ . : coalesced 
. count( $changes ) .  into  . count( $coalesced ) . 
 changes  );
@@ -364,9 +363,9 @@
 * @param Change $a
 * @param Change $b
 *
-* @return Mixed
+* @return int
 */
-   public static function compareChangesByTimestamp( Change $a, Change $b 
) {
+   public function compareChangesByTimestamp( Change $a, Change $b ) {
//NOTE: beware https://bugs.php.net/bug.php?id=50688 !
 
if ( $a-getTime()  $b-getTime() ) {
@@ -552,7 +551,7 @@
 *
 * @since 0.4
 *
-* @param \Wikibase\EntityChange $change The Change that caused the 
update
+* @param EntityChange $change The Change that caused the update
 *
 * @return array|boolean an array of RC attributes,
 * or false if the change does not provide edit meta data
@@ -644,7 +643,7 @@
 *
 * @param EntityChange $change the change to get a comment for
 *
-* @throws \MWException
+* @throws MWException
 * @return array
 */
public function getEditComment( EntityChange $change ) {
@@ -659,7 +658,7 @@
 
$editComment = $commentCreator-getEditComment( $siteLinkDiff, 
$action, $comment );
if( is_array( $editComment )  !isset( $editComment['message'] 
) ) {
-   throw new \MWException( 'getEditComment returned an 
empty comment' );
+   throw new MWException( 'getEditComment returned an 
empty comment' );
}
 
return $editComment;
diff --git a/client/includes/Changes/PageUpdater.php 
b/client/includes/Changes/PageUpdater.php
index 5246cce..d7cf15f 100644
--- a/client/includes/Changes/PageUpdater.php
+++ b/client/includes/Changes/PageUpdater.php
@@ -2,6 +2,8 @@
 
 namespace Wikibase\Client\Changes;
 
+use Title;
+
 /**
  * Service interface for triggering different kinds of page updates
  * and generally notifying the local wiki of external changes.
@@ -21,7 +23,7 @@
 *
 * @since0.4
 *
-* @param \Title[] $titles The Titles of the pages to update
+* @param Title[] $titles The Titles of the pages to update
 */
public function purgeParserCache( array $titles );
 
@@ -30,7 +32,7

[MediaWiki-commits] [Gerrit] Change @throw to @throws - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172977

Change subject: Change @throw to @throws
..

Change @throw to @throws

Change-Id: I40067da35283f99ccf49f7fbc2cd76f9b62bc302
---
M lib/includes/store/CachingEntityRevisionLookup.php
M lib/includes/store/EntityLookup.php
M lib/includes/store/EntityRevisionLookup.php
M lib/includes/store/RedirectResolvingEntityLookup.php
M lib/includes/store/RevisionBasedEntityLookup.php
M lib/tests/phpunit/MockRepository.php
6 files changed, 11 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/77/172977/1

diff --git a/lib/includes/store/CachingEntityRevisionLookup.php 
b/lib/includes/store/CachingEntityRevisionLookup.php
index c6073cd..8db4bef 100644
--- a/lib/includes/store/CachingEntityRevisionLookup.php
+++ b/lib/includes/store/CachingEntityRevisionLookup.php
@@ -97,7 +97,7 @@
 * @param EntityId $entityId
 * @param int  $revisionId The desired revision id, 0 means 
current.
 *
-* @throw StorageException
+* @throws StorageException
 * @return EntityRevision|null
 */
public function getEntityRevision( EntityId $entityId, $revisionId = 0 
) {
@@ -136,8 +136,8 @@
 * @param EntityId $entityId
 * @param int $revisionId
 *
-* @throw StorageException
-* @return null|EntityRevision
+* @throws StorageException
+* @return EntityRevision|null
 */
private function fetchEntityRevision( EntityId $entityId, $revisionId = 
0 ) {
wfProfileIn( __METHOD__ );
diff --git a/lib/includes/store/EntityLookup.php 
b/lib/includes/store/EntityLookup.php
index 860f040..52e6a54 100644
--- a/lib/includes/store/EntityLookup.php
+++ b/lib/includes/store/EntityLookup.php
@@ -28,7 +28,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return Entity|null
 */
public function getEntity( EntityId $entityId );
@@ -46,7 +46,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return bool
 */
public function hasEntity( EntityId $entityId );
diff --git a/lib/includes/store/EntityRevisionLookup.php 
b/lib/includes/store/EntityRevisionLookup.php
index 60979fa..c028f4b 100644
--- a/lib/includes/store/EntityRevisionLookup.php
+++ b/lib/includes/store/EntityRevisionLookup.php
@@ -28,7 +28,7 @@
 * @param EntityId $entityId
 * @param int $revisionId The desired revision id, 0 means current.
 *
-* @throw StorageException
+* @throws StorageException
 * @return EntityRevision|null
 */
public function getEntityRevision( EntityId $entityId, $revisionId = 0 
);
diff --git a/lib/includes/store/RedirectResolvingEntityLookup.php 
b/lib/includes/store/RedirectResolvingEntityLookup.php
index 685caa6..9b33c3c 100644
--- a/lib/includes/store/RedirectResolvingEntityLookup.php
+++ b/lib/includes/store/RedirectResolvingEntityLookup.php
@@ -43,7 +43,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return Entity|null
 */
public function getEntity( EntityId $entityId ) {
@@ -58,7 +58,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return bool
 */
public function hasEntity( EntityId $entityId ) {
diff --git a/lib/includes/store/RevisionBasedEntityLookup.php 
b/lib/includes/store/RevisionBasedEntityLookup.php
index 32e41cd..ef455a3 100644
--- a/lib/includes/store/RevisionBasedEntityLookup.php
+++ b/lib/includes/store/RevisionBasedEntityLookup.php
@@ -34,7 +34,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return Entity|null
 */
public function getEntity( EntityId $entityId ) {
@@ -47,7 +47,7 @@
 *
 * @param EntityId $entityId
 *
-* @throw StorageException
+* @throws StorageException
 * @return bool
 */
public function hasEntity( EntityId $entityId ) {
diff --git a/lib/tests/phpunit/MockRepository.php 
b/lib/tests/phpunit/MockRepository.php
index f644b3c..a4b9ef9 100644
--- a/lib/tests/phpunit/MockRepository.php
+++ b/lib/tests/phpunit/MockRepository.php
@@ -95,7 +95,7 @@
 *
 * @return Entity|null
 *
-* @throw StorageException
+* @throws StorageException
 */
public function getEntity( EntityId $entityId ) {
$rev = $this-getEntityRevision( $entityId

[MediaWiki-commits] [Gerrit] Optimize all use sections in Repo - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172997

Change subject: Optimize all use sections in Repo
..

Optimize all use sections in Repo

Stuff that's not in a namespace needs the backslash and can not
be added to the use section because PHPStorm thinks it can remove
this. Yes, that's probably a bug in PHPStorm but since multiple
team members use it it's much easier to just do it as I did here
than to wait for a bugfix.

Change-Id: I8fa5b47b9c18d621cb964e7200b187b5e2d09bab
---
M repo/maintenance/dumpJson.php
M repo/maintenance/importProperties.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
M repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
M repo/tests/phpunit/includes/Diff/DiffViewTest.php
M repo/tests/phpunit/includes/ItemDisambiguationTest.php
M repo/tests/phpunit/includes/ItemMoveTest.php
M repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
M repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteJobTest.php
M repo/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveJobTest.php
M repo/tests/phpunit/includes/View/SiteLinksViewTest.php
M repo/tests/phpunit/includes/actions/EditEntityActionTest.php
M repo/tests/phpunit/includes/api/ApiErrorReporterTest.php
M repo/tests/phpunit/includes/api/ApiModuleTestHelper.php
M repo/tests/phpunit/includes/api/ApiXmlFormatTest.php
M repo/tests/phpunit/includes/api/AvailableBadgesTest.php
M repo/tests/phpunit/includes/api/BotEditTest.php
M repo/tests/phpunit/includes/api/IntegrationApiTest.php
M repo/tests/phpunit/includes/api/WikibaseApiTestCase.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
22 files changed, 23 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/97/172997/1

diff --git a/repo/maintenance/dumpJson.php b/repo/maintenance/dumpJson.php
index 3e00b25..7996a46 100644
--- a/repo/maintenance/dumpJson.php
+++ b/repo/maintenance/dumpJson.php
@@ -15,10 +15,10 @@
 use Wikibase\Lib\Serializers\Serializer;
 use Wikibase\Lib\Serializers\SerializerFactory;
 use Wikibase\Lib\Store\EntityLookup;
-use Wikibase\Repo\Store\SQL\EntityPerPageIdPager;
 use Wikibase\Repo\IO\EntityIdReader;
 use Wikibase\Repo\IO\LineReader;
 use Wikibase\Repo\Store\EntityIdPager;
+use Wikibase\Repo\Store\SQL\EntityPerPageIdPager;
 use Wikibase\Repo\WikibaseRepo;
 
 $basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' 
) : __DIR__ . '/../../../..';
diff --git a/repo/maintenance/importProperties.php 
b/repo/maintenance/importProperties.php
index cfd9db9..9f185f3 100644
--- a/repo/maintenance/importProperties.php
+++ b/repo/maintenance/importProperties.php
@@ -1,8 +1,8 @@
 ?php
 
 use Wikibase\DataModel\Entity\Property;
-use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Lib\Store\EntityStore;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Maintenance script for importing properties in Wikidata.
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
index 3c80b0c..f846cf2 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php
@@ -4,11 +4,9 @@
 
 use DataValues\NumberValue;
 use DataValues\StringValue;
-use InvalidArgumentException;
 use Wikibase\ChangeOp\ChangeOpClaim;
 use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\Claim\ClaimGuidParser;
-use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
diff --git a/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php 
b/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
index aa0760f..ffa9c43 100644
--- a/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
+++ b/repo/tests/phpunit/includes/Diff/ClaimDifferTest.php
@@ -3,11 +3,11 @@
 namespace Wikibase\Test;
 
 use Diff\Comparer\ComparableComparer;
+use Diff\Differ\OrderedListDiffer;
 use Diff\DiffOp\Diff\Diff;
 use Diff\DiffOp\DiffOpAdd;
 use Diff\DiffOp\DiffOpChange;
 use Diff\DiffOp\DiffOpRemove;
-use Diff\Differ\OrderedListDiffer;
 use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\ReferenceList;
 use Wikibase\DataModel\Snak\PropertyNoValueSnak;
diff --git a/repo/tests/phpunit/includes/Diff/DiffViewTest.php 
b/repo/tests/phpunit/includes/Diff/DiffViewTest.php
index 54ca345..0a86d48 100644
--- a/repo/tests/phpunit/includes/Diff/DiffViewTest.php
+++ b/repo/tests/phpunit/includes/Diff/DiffViewTest.php
@@ -6,7 +6,6 @@
 use Diff\DiffOp\DiffOpAdd;
 use Diff\DiffOp\DiffOpChange;
 use Diff\DiffOp\DiffOpRemove;
-use RequestContext;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Repo\Diff

[MediaWiki-commits] [Gerrit] Optimize all use sections in Lib - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172998

Change subject: Optimize all use sections in Lib
..

Optimize all use sections in Lib

Change-Id: I79df2962f6f2932986aae1f37ca8bfb9836be09f
---
M lib/includes/changes/EntityChange.php
M lib/includes/formatters/EntityIdLabelFormatter.php
M lib/includes/formatters/WikibaseValueFormatterBuilders.php
M lib/includes/store/EntityRetrievingTermLookup.php
M lib/includes/store/TermIndex.php
M lib/includes/store/TermLookup.php
M lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php
M lib/tests/phpunit/formatters/EntityIdLabelFormatterTest.php
M lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php
M lib/tests/phpunit/serializers/SnakSerializerTest.php
M lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php
M lib/tests/phpunit/store/TermIndexTest.php
12 files changed, 9 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/98/172998/1

diff --git a/lib/includes/changes/EntityChange.php 
b/lib/includes/changes/EntityChange.php
index 68fec7f..b5e3926 100644
--- a/lib/includes/changes/EntityChange.php
+++ b/lib/includes/changes/EntityChange.php
@@ -8,9 +8,9 @@
 use User;
 use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Claim\Claim;
+use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\DataModel\Entity\BasicEntityIdParser;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
diff --git a/lib/includes/formatters/EntityIdLabelFormatter.php 
b/lib/includes/formatters/EntityIdLabelFormatter.php
index 1081797..30e0bcb 100644
--- a/lib/includes/formatters/EntityIdLabelFormatter.php
+++ b/lib/includes/formatters/EntityIdLabelFormatter.php
@@ -9,7 +9,6 @@
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\Lib\Store\LabelLookup;
 use Wikibase\Lib\Store\StorageException;
-use Wikibase\Lib\Store\UnresolvedRedirectException;
 
 /**
  * @since 0.4
diff --git a/lib/includes/formatters/WikibaseValueFormatterBuilders.php 
b/lib/includes/formatters/WikibaseValueFormatterBuilders.php
index 414d722..5596a21 100644
--- a/lib/includes/formatters/WikibaseValueFormatterBuilders.php
+++ b/lib/includes/formatters/WikibaseValueFormatterBuilders.php
@@ -13,11 +13,11 @@
 use ValueFormatters\ValueFormatter;
 use Wikibase\LanguageFallbackChain;
 use Wikibase\LanguageFallbackChainFactory;
+use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Lib\Store\EntityRetrievingTermLookup;
+use Wikibase\Lib\Store\EntityTitleLookup;
 use Wikibase\Lib\Store\LanguageFallbackLabelLookup;
 use Wikibase\Lib\Store\LanguageLabelLookup;
-use Wikibase\Lib\Store\EntityLookup;
-use Wikibase\Lib\Store\EntityTitleLookup;
 
 /**
  * Defines the formatters for DataValues supported by Wikibase.
diff --git a/lib/includes/store/EntityRetrievingTermLookup.php 
b/lib/includes/store/EntityRetrievingTermLookup.php
index f62b68d..ba5cc60 100644
--- a/lib/includes/store/EntityRetrievingTermLookup.php
+++ b/lib/includes/store/EntityRetrievingTermLookup.php
@@ -3,11 +3,8 @@
 namespace Wikibase\Lib\Store;
 
 use OutOfBoundsException;
-use Wikibase\DataModel\Entity\EntityId;
 use Wikibaes\DataModel\Term\Fingerprint;
-use Wikibase\Lib\Store\EntityLookup;
-use Wikibase\Lib\Store\StorageException;
-use Wikibase\Lib\Store\UnresolvedRedirectException;
+use Wikibase\DataModel\Entity\EntityId;
 
 /**
  * @since 0.5
diff --git a/lib/includes/store/TermIndex.php b/lib/includes/store/TermIndex.php
index 8b36af2..e975e90 100644
--- a/lib/includes/store/TermIndex.php
+++ b/lib/includes/store/TermIndex.php
@@ -2,9 +2,9 @@
 
 namespace Wikibase;
 
-use Wikibase\Lib\Store\LabelConflictFinder;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\Lib\Store\LabelConflictFinder;
 
 /**
  * Interface to a cache for terms with both write and lookup methods.
diff --git a/lib/includes/store/TermLookup.php 
b/lib/includes/store/TermLookup.php
index 4c1b065..0a2ed8d 100644
--- a/lib/includes/store/TermLookup.php
+++ b/lib/includes/store/TermLookup.php
@@ -4,7 +4,6 @@
 
 use OutOfBoundsException;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\Lib\Store\StorageException;
 
 /**
  * @since 0.5
diff --git a/lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php 
b/lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php
index d98285c..d0bbb8e 100644
--- a/lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php
+++ b/lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php
@@ -3,9 +3,9 @@
 namespace Wikibase\Lib\Test;
 
 use Wikibase\DataModel\Entity\Property;
+use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\Lib\EntityRetrievingDataTypeLookup;
-use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
 use Wikibase\Lib\PropertyInfoDataTypeLookup;
 use Wikibase\PropertyInfoStore;
 use

[MediaWiki-commits] [Gerrit] Optimize all use sections in Client - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172999

Change subject: Optimize all use sections in Client
..

Optimize all use sections in Client

Change-Id: I6ab1d09a3e55ac7d8b25362c187969015ad1f68b
---
M client/includes/Changes/ChangeHandler.php
M client/includes/DataAccess/PropertyIdResolver.php
M client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php
M 
client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php
M client/includes/DataAccess/PropertyParserFunction/Runner.php
M client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php
M client/includes/DataAccess/PropertyParserFunction/VariantsAwareRenderer.php
M client/includes/LangLinkHandler.php
M client/includes/Usage/Sql/UsageTableUpdater.php
M client/includes/WikibaseClient.php
M client/includes/hooks/DataUpdateHookHandlers.php
M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
M client/includes/scribunto/WikibaseLuaBindings.php
M client/includes/store/ClientStore.php
M client/includes/store/sql/DirectSqlStore.php
M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
M client/tests/phpunit/includes/Usage/UsageAccumulatorContractTester.php
M client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
M client/tests/phpunit/includes/Usage/UsageTrackerContractTester.php
M client/tests/phpunit/includes/UsageUpdaterTest.php
M client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php
M client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
M client/tests/phpunit/includes/store/TitleFactoryTest.php
31 files changed, 43 insertions(+), 71 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/99/172999/1

diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index 5ff4576..4885c35 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -6,8 +6,6 @@
 use MWException;
 use Title;
 use Wikibase\Change;
-use Wikibase\Client\Changes\AffectedPagesFinder;
-use Wikibase\Client\Changes\PageUpdater;
 use Wikibase\DataModel\Entity\Diff\EntityDiff;
 use Wikibase\DataModel\Entity\Diff\ItemDiff;
 use Wikibase\EntityChange;
diff --git a/client/includes/DataAccess/PropertyIdResolver.php 
b/client/includes/DataAccess/PropertyIdResolver.php
index 395377b..d4a77ed 100644
--- a/client/includes/DataAccess/PropertyIdResolver.php
+++ b/client/includes/DataAccess/PropertyIdResolver.php
@@ -3,8 +3,6 @@
 namespace Wikibase\DataAccess;
 
 use InvalidArgumentException;
-use Wikibase\DataModel\Entity\Entity;
-use Wikibase\DataModel\Entity\EntityIdParsingException;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\Lib\PropertyLabelNotResolvedException;
 use Wikibase\PropertyLabelResolver;
diff --git 
a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php 
b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php
index 84fa3c6..8af6deb 100644
--- 
a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php
+++ 
b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php
@@ -5,10 +5,8 @@
 use InvalidArgumentException;
 use Language;
 use Status;
-use Wikibase\Client\WikibaseClient;
+use Wikibase\Client\Usage\UsageAccumulator;
 use Wikibase\DataAccess\PropertyIdResolver;
-use Wikibase\DataModel\Claim\Claims;
-use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\EntityIdValue;
 use Wikibase\DataModel\Entity\PropertyId;
@@ -16,7 +14,6 @@
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\Lib\PropertyLabelNotResolvedException;
 use Wikibase\Lib\SnakFormatter;
-use Wikibase\Client\Usage\UsageAccumulator;
 
 /**
  * PropertyClaimsRenderer of the {{#property}} parser function.
diff --git 
a/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php
 
b/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php
index ef2eccd..7afbdab 100644
--- 
a/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php
+++ 
b/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php
@@ -5,12 +5,12

[MediaWiki-commits] [Gerrit] Increase selector precedence for aliasesview in fingerprintview - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173017

Change subject: Increase selector precedence for aliasesview in fingerprintview
..

Increase selector precedence for aliasesview in fingerprintview

The selectors
.wikibase-aliasesview .wikibase-aliasesview-container
and
.wikibase-fingerprintview .wikibase-aliasesview-container
had the same precedence. Which means the decision which is more
important purely depends on the loading order of the two CSS files.
This makes the more specific selector more specific.

Change-Id: I2273bf1d5b133fcd0c105b6032ec48e77e6749ab
---
M 
lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintview.css
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/17/173017/1

diff --git 
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintview.css
 
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintview.css
index 2ed2254..5462cde 100644
--- 
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintview.css
+++ 
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintview.css
@@ -58,7 +58,7 @@
width: auto;
 }
 
-.wikibase-fingerprintview .wikibase-aliasesview-container {
+.wikibase-fingerprintview .wikibase-aliasesview 
.wikibase-aliasesview-container {
display: inline-block !important;
padding-left: 0;
padding-right: 0;

-- 
To view, visit https://gerrit.wikimedia.org/r/173017
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2273bf1d5b133fcd0c105b6032ec48e77e6749ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Move parsers from lib to repo - change (mediawiki...Wikibase)

2014-11-13 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Move parsers from lib to repo
..


Move parsers from lib to repo

They are only used in repo.

Change-Id: I08bd8883614f1c85b71b52a3f5f56a9646b9f410
---
M lib/resources/Resources.php
M repo/resources/Resources.php
R repo/resources/parsers/getApiBasedValueParserConstructor.js
R repo/resources/parsers/getStore.js
R repo/resources/parsers/resources.php
5 files changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Thiemo Mättig (WMDE): Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index 39e1dc3..deb74bd 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -146,7 +146,6 @@
include( __DIR__ . '/deprecated/resources.php' ),
include( __DIR__ . '/experts/resources.php' ),
include( __DIR__ . '/jquery.wikibase/resources.php' ),
-   include( __DIR__ . '/parsers/resources.php' ),
include( __DIR__ . '/wikibase.RepoApi/resources.php' )
);
 
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index f60a020..99ca550 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -230,6 +230,7 @@
$modules,
include( __DIR__ . '/entityChangers/resources.php' ),
include( __DIR__ . '/formatters/resources.php' ),
+   include( __DIR__ . '/parsers/resources.php' ),
include( __DIR__ . '/store/resources.php' ),
include( __DIR__ . '/utilities/resources.php' )
);
diff --git a/lib/resources/parsers/getApiBasedValueParserConstructor.js 
b/repo/resources/parsers/getApiBasedValueParserConstructor.js
similarity index 100%
rename from lib/resources/parsers/getApiBasedValueParserConstructor.js
rename to repo/resources/parsers/getApiBasedValueParserConstructor.js
diff --git a/lib/resources/parsers/getStore.js 
b/repo/resources/parsers/getStore.js
similarity index 100%
rename from lib/resources/parsers/getStore.js
rename to repo/resources/parsers/getStore.js
diff --git a/lib/resources/parsers/resources.php 
b/repo/resources/parsers/resources.php
similarity index 100%
rename from lib/resources/parsers/resources.php
rename to repo/resources/parsers/resources.php

-- 
To view, visit https://gerrit.wikimedia.org/r/172966
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08bd8883614f1c85b71b52a3f5f56a9646b9f410
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Use $this-settings instead of $this-getSettings - change (mediawiki...Wikibase)

2014-11-14 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173262

Change subject: Use $this-settings instead of $this-getSettings
..

Use $this-settings instead of $this-getSettings

Also see Ib5bb23d. Please merge this patch here first,
I will rebase the other later.

Change-Id: I083a9890f79c4d72f77f8ed7da52e9ed39f0b62e
---
M client/includes/WikibaseClient.php
1 file changed, 34 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/62/173262/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index c743255..137bb3b 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -15,8 +15,9 @@
 use SiteSQLStore;
 use SiteStore;
 use ValueFormatters\FormatterOptions;
-use Wikibase\Client\Changes\ChangeHandler;
 use Wikibase\Client\Changes\AffectedPagesFinder;
+use Wikibase\Client\Changes\ChangeHandler;
+use Wikibase\Client\Changes\WikiPageUpdater;
 use Wikibase\Client\Hooks\LanguageLinkBadgeDisplay;
 use Wikibase\Client\Hooks\OtherProjectsSidebarGenerator;
 use Wikibase\Client\Hooks\ParserFunctionRegistrant;
@@ -52,7 +53,6 @@
 use Wikibase\Settings;
 use Wikibase\SettingsArray;
 use Wikibase\StringNormalizer;
-use Wikibase\Client\Changes\WikiPageUpdater;
 
 /**
  * Top level factory for the WikibaseClient extension.
@@ -126,14 +126,14 @@
private $valueFormatterFactory;
 
/**
-* @var SiteList
-*/
-   private $siteList = null;
-
-   /**
 * @var SiteStore
 */
private $siteStore;
+
+   /**
+* @var SiteList|null
+*/
+   private $siteList = null;
 
/**
 * @var LangLinkHandler
@@ -169,7 +169,7 @@
 */
public function getDataTypeFactory() {
if ( $this-dataTypeFactory === null ) {
-   $urlSchemes = $this-getSettings()-getSetting( 
'urlSchemes' );
+   $urlSchemes = $this-settings-getSetting( 'urlSchemes' 
);
$builders = new WikibaseDataTypeBuilders(
$this-getEntityLookup(),
$this-getEntityIdParser(),
@@ -481,9 +481,7 @@
$this-getDataTypeFactory()
);
 
-   $factory = new OutputFormatSnakFormatterFactory( 
$builders-getSnakFormatterBuildersForFormats() );
-
-   return $factory;
+   return new OutputFormatSnakFormatterFactory( 
$builders-getSnakFormatterBuildersForFormats() );
}
 
/**
@@ -509,9 +507,7 @@
$this-contentLanguage
);
 
-   $factory = new OutputFormatValueFormatterFactory( 
$builders-getValueFormatterBuildersForFormats() );
-
-   return $factory;
+   return new OutputFormatValueFormatterFactory( 
$builders-getValueFormatterBuildersForFormats() );
}
 
/**
@@ -519,11 +515,9 @@
 */
public function getNamespaceChecker() {
if ( !$this-namespaceChecker ) {
-   $settings = $this-getSettings();
-
$this-namespaceChecker = new NamespaceChecker(
-   $settings-getSetting( 'excludeNamespaces' ),
-   $settings-getSetting( 'namespaces' )
+   $this-settings-getSetting( 
'excludeNamespaces' ),
+   $this-settings-getSetting( 'namespaces' )
);
}
 
@@ -535,12 +529,10 @@
 */
public function getLangLinkHandler() {
if ( !$this-langLinkHandler ) {
-   $settings = $this-getSettings();
-
$this-langLinkHandler = new LangLinkHandler(
$this-getOtherProjectsSidebarGenerator(),
$this-getLanguageLinkBadgeDisplay(),
-   $settings-getSetting( 'siteGlobalID' ),
+   $this-settings-getSetting( 'siteGlobalID' ),
$this-getNamespaceChecker(),
$this-getStore()-getSiteLinkTable(),
$this-getStore()-getEntityLookup(),
@@ -558,24 +550,13 @@
public function getLanguageLinkBadgeDisplay() {
global $wgLang;
 
-   $badgeClassNames = $this-getSettings()-getSetting( 
'badgeClassNames' );
+   $badgeClassNames = $this-settings-getSetting( 
'badgeClassNames' );
 
return new LanguageLinkBadgeDisplay(
$this-getEntityLookup(),
is_array( $badgeClassNames ) ? $badgeClassNames : 
array(),
$wgLang

[MediaWiki-commits] [Gerrit] Rename dataTypes to dataTypeStore - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173773

Change subject: Rename dataTypes to dataTypeStore
..

Rename dataTypes to dataTypeStore

wbDataTypes is the settings array. This is not an array but a store
object. I hope I did not forget something. Please double check.

Change-Id: Ib885aeafe03e7ac9e3319416273fa5ceed30630e
---
M lib/resources/Resources.php
M lib/tests/qunit/resources.php
M repo/resources/Resources.php
R repo/resources/dataTypes/wikibase.dataTypeStore.js
M repo/resources/wikibase.ui.entityViewInit.js
R repo/tests/qunit/dataTypes/wikibase.dataTypeStore.tests.js
M repo/tests/qunit/resources.php
7 files changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/73/173773/1

diff --git a/lib/resources/Resources.php b/lib/resources/Resources.php
index 6d4c30c..cd28662 100644
--- a/lib/resources/Resources.php
+++ b/lib/resources/Resources.php
@@ -83,9 +83,9 @@
),
),
 
-   'wikibase.dataTypes' = $moduleTemplate + array(
+   'wikibase.dataTypeStore' = $moduleTemplate + array(
'scripts' = array(
-   'wikibase.dataTypes/wikibase.dataTypes.js',
+   'wikibase.dataTypes/wikibase.dataTypeStore.js',
),
'dependencies' = array(
'dataTypes.DataType',
diff --git a/lib/tests/qunit/resources.php b/lib/tests/qunit/resources.php
index 608c56a..b2ea9b3 100644
--- a/lib/tests/qunit/resources.php
+++ b/lib/tests/qunit/resources.php
@@ -35,13 +35,13 @@
),
),
 
-   'wikibase.dataTypes.tests' = $moduleBase + array(
+   'wikibase.dataTypeStore.tests' = $moduleBase + array(
'scripts' = array(
-   
'wikibase.dataTypes/wikibase.dataTypes.tests.js',
+   
'wikibase.dataTypes/wikibase.dataTypeStore.tests.js',
),
'dependencies' = array(
'dataTypes.DataTypeStore',
-   'wikibase.dataTypes',
+   'wikibase.dataTypeStore',
),
),
 
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index bbe86b1..8ac0467 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -111,9 +111,9 @@
'datatypesconfigvarname' = 'wbDataTypes',
),
 
-   'wikibase.dataTypes' = $moduleTemplate + array(
+   'wikibase.dataTypeStore' = $moduleTemplate + array(
'scripts' = array(
-   'dataTypes/wikibase.dataTypes.js',
+   'dataTypes/wikibase.dataTypeStore.js',
),
'dependencies' = array(
'dataTypes.DataType',
@@ -161,7 +161,7 @@
'jquery.wikibase.claimgrouplabelscroll',
'jquery.wikibase.sitelinkgroupview',
'wikibase.api.getLocationAgnosticMwApi',
-   'wikibase.dataTypes',
+   'wikibase.dataTypeStore',
'wikibase.entityChangers.EntityChangersFactory',
'wikibase.experts.getStore',
'wikibase.formatters.getStore',
diff --git a/repo/resources/dataTypes/wikibase.dataTypes.js 
b/repo/resources/dataTypes/wikibase.dataTypeStore.js
similarity index 89%
rename from repo/resources/dataTypes/wikibase.dataTypes.js
rename to repo/resources/dataTypes/wikibase.dataTypeStore.js
index 38204d3..0d93c8e 100644
--- a/repo/resources/dataTypes/wikibase.dataTypes.js
+++ b/repo/resources/dataTypes/wikibase.dataTypeStore.js
@@ -3,7 +3,7 @@
  * @author Daniel Werner  daniel.wer...@wikimedia.de 
  * @author H. Snater  mediaw...@snater.com 
  */
-wikibase.dataTypes = ( function( $, mw, dataTypes ) {
+wikibase.dataTypeStore = ( function( $, mw, dataTypes ) {
'use strict';
 
var dataTypeStore = new dataTypes.DataTypeStore(),
diff --git a/repo/resources/wikibase.ui.entityViewInit.js 
b/repo/resources/wikibase.ui.entityViewInit.js
index f117734..c856ff5 100644
--- a/repo/resources/wikibase.ui.entityViewInit.js
+++ b/repo/resources/wikibase.ui.entityViewInit.js
@@ -342,7 +342,7 @@
jQuery,
mediaWiki,
wikibase,
-   wikibase.dataTypes,
+   wikibase.dataTypeStore,
wikibase.experts.getStore,
wikibase.formatters.getStore,
wikibase.parsers.getStore
diff --git a/repo/tests/qunit/dataTypes

[MediaWiki-commits] [Gerrit] Move Client tests to namespace Wikibase\Client\Tests - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173786

Change subject: Move Client tests to namespace Wikibase\Client\Tests
..

Move Client tests to namespace Wikibase\Client\Tests

Change-Id: I91405828401834543323e9b15e80e5bbda9fb289
---
M client/tests/phpunit/includes/InterwikiSorterTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M client/tests/phpunit/includes/NamespaceCheckerTest.php
M client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
M client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
M client/tests/phpunit/includes/RepoLinkerTest.php
M client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
M client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
9 files changed, 21 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/86/173786/1

diff --git a/client/tests/phpunit/includes/InterwikiSorterTest.php 
b/client/tests/phpunit/includes/InterwikiSorterTest.php
index 71f26dc..25081ec 100644
--- a/client/tests/phpunit/includes/InterwikiSorterTest.php
+++ b/client/tests/phpunit/includes/InterwikiSorterTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Wikibase\InterwikiSorter;
 
diff --git a/client/tests/phpunit/includes/LangLinkHandlerTest.php 
b/client/tests/phpunit/includes/LangLinkHandlerTest.php
index cece49e..cdfeafe 100644
--- a/client/tests/phpunit/includes/LangLinkHandlerTest.php
+++ b/client/tests/phpunit/includes/LangLinkHandlerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use MediaWikiSite;
 use ParserOutput;
@@ -15,6 +15,8 @@
 use Wikibase\LangLinkHandler;
 use Wikibase\NamespaceChecker;
 use Wikibase\NoLangLinkHandler;
+use Wikibase\Test\MockRepository;
+use Wikibase\Test\MockSiteStore;
 
 /**
  * @covers Wikibase\LangLinkHandler
@@ -28,10 +30,14 @@
  */
 class LangLinkHandlerTest extends \MediaWikiTestCase {
 
-   /* @var MockRepository $mockRepo */
+   /**
+* @var MockRepository $mockRepo
+*/
private $mockRepo;
 
-   /* @var LangLinkHandler $langLinkHandler */
+   /**
+* @var LangLinkHandler $langLinkHandler
+*/
private $langLinkHandler;
 
private function getItems() {
diff --git a/client/tests/phpunit/includes/NamespaceCheckerTest.php 
b/client/tests/phpunit/includes/NamespaceCheckerTest.php
index d9d136a..7c0b573 100644
--- a/client/tests/phpunit/includes/NamespaceCheckerTest.php
+++ b/client/tests/phpunit/includes/NamespaceCheckerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use MWNamespace;
 use Wikibase\NamespaceChecker;
@@ -103,4 +103,5 @@
$result = $namespaceChecker-getWikibaseNamespaces();
$this-assertArrayEquals( $expected, $result );
}
+
 }
diff --git a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php 
b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
index 4c32458..f682702 100644
--- a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
+++ b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Client\Test;
+namespace Wikibase\Client\Tests;
 
 use MediaWikiSite;
 use Site;
@@ -172,4 +172,5 @@
 
return new MockSiteStore( $sites );
}
+
 }
diff --git a/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php 
b/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
index d239850..d65db2e 100644
--- a/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
+++ b/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Language;
 use Title;
diff --git a/client/tests/phpunit/includes/RepoLinkerTest.php 
b/client/tests/phpunit/includes/RepoLinkerTest.php
index d23f5dd..a54a6b9 100644
--- a/client/tests/phpunit/includes/RepoLinkerTest.php
+++ b/client/tests/phpunit/includes/RepoLinkerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Wikibase\Client\RepoLinker;
 use Wikibase\DataModel\Entity\EntityId;
diff --git a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php 
b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
index 4835540..41de08e 100644
--- a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
+++ b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Diff\DiffOp\Diff\Diff;
 use Diff\DiffOp\DiffOpChange;
@@ -9,6 +9,7 @@
 use Wikibase\DataModel\SiteLink;
 use Wikibase\ItemChange;
 use Wikibase\SiteLinkCommentCreator;
+use Wikibase\Test

[MediaWiki-commits] [Gerrit] Fix namespace of all Wikibase\Client\DataAccess tests - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173787

Change subject: Fix namespace of all Wikibase\Client\DataAccess tests
..

Fix namespace of all Wikibase\Client\DataAccess tests

Change-Id: Id4a67784a7da6be860aa592159c7641397f04291
---
M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/VariantsAwareRendererTest.php
6 files changed, 7 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/87/173787/1

diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php 
b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
index 46e60a2..ff1a82d 100644
--- a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
+++ b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
@@ -1,11 +1,9 @@
 ?php
 
-namespace Wikibase\DataAccess\Tests;
+namespace Wikibase\Client\Tests\DataAccess;
 
 use DataValues\StringValue;
 use Wikibase\DataAccess\PropertyIdResolver;
-use Wikibase\DataModel\Claim;
-use Wikibase\DataModel\Claim\Statement;
 use Wikibase\DataModel\Entity\Property;
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\Test\MockPropertyLabelResolver;
@@ -79,4 +77,5 @@
array( 'Q100' )
);
}
+
 }
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
index 2fcd320..6cf0450 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\DataAccess\Tests\PropertyParserFunction;
+namespace Wikibase\Client\Tests\DataAccess\PropertyParserFunction;
 
 use DataValues\StringValue;
 use Language;
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
index 7c555ae..e787251 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\DataAccess\Tests;
+namespace Wikibase\Client\Tests\DataAccess\PropertyParserFunction;
 
 use Language;
 use Parser;
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
index c277654..822f607 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\DataAccess\Tests\PropertyParserFunction;
+namespace Wikibase\Client\Tests\DataAccess\PropertyParserFunction;
 
 use Parser;
 use ParserOptions;
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
index 571f252..9bc91f9 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\DataAccess\Tests\PropertyParserFunction;
+namespace Wikibase\Client\Tests\DataAccess\PropertyParserFunction;
 
 use DataValues\StringValue;
 use Wikibase\DataAccess\PropertyParserFunction\SnaksFinder;
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/VariantsAwareRendererTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/VariantsAwareRendererTest.php
index d70a427..72c792e 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/VariantsAwareRendererTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/VariantsAwareRendererTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\DataAccess\PropertyParserFunction;
 
 use Wikibase\Client\Usage\UsageAccumulator;
 use Wikibase\DataAccess\PropertyParserFunction

[MediaWiki-commits] [Gerrit] Move all remaining client tests to specific namespaces - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173788

Change subject: Move all remaining client tests to specific namespaces
..

Move all remaining client tests to specific namespaces

Change-Id: Iacce38e02a95fcfe278991ab64f97f257810396f
---
M client/tests/phpunit/includes/api/ApiClientInfoTest.php
M client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php
M client/tests/phpunit/includes/hooks/BeforePageDisplayHandlerTest.php
M client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
M client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php
M client/tests/phpunit/includes/hooks/MovePageNoticeTest.php
M client/tests/phpunit/includes/hooks/SpecialWatchlistQueryHandlerTest.php
M client/tests/phpunit/includes/recentchanges/ChangeLineFormatterTest.php
M client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
M client/tests/phpunit/includes/recentchanges/RecentChangesFilterOptionsTest.php
M client/tests/phpunit/includes/recentchanges/RevisionDataTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
M client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
M client/tests/phpunit/includes/specials/SpecialUnconnectedPagesTest.php
M client/tests/phpunit/includes/store/TitleFactoryTest.php
M client/tests/phpunit/includes/store/sql/ConnectionManagerTest.php
M client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
18 files changed, 26 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/88/173788/1

diff --git a/client/tests/phpunit/includes/api/ApiClientInfoTest.php 
b/client/tests/phpunit/includes/api/ApiClientInfoTest.php
index 2897ee0..66dc746 100644
--- a/client/tests/phpunit/includes/api/ApiClientInfoTest.php
+++ b/client/tests/phpunit/includes/api/ApiClientInfoTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Api;
 
 use ApiMain;
 use ApiQuery;
diff --git 
a/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php 
b/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php
index ddcce3c..d7bda70 100644
--- a/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php
+++ b/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Hooks;
 
 use Wikibase\Client\Hooks\BaseTemplateAfterPortletHandler;
 
diff --git 
a/client/tests/phpunit/includes/hooks/BeforePageDisplayHandlerTest.php 
b/client/tests/phpunit/includes/hooks/BeforePageDisplayHandlerTest.php
index 44e4abe..9b2fc63 100644
--- a/client/tests/phpunit/includes/hooks/BeforePageDisplayHandlerTest.php
+++ b/client/tests/phpunit/includes/hooks/BeforePageDisplayHandlerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Hooks;
 
 use RequestContext;
 use Skin;
diff --git a/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php 
b/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
index 2f91f94..4ebd897 100644
--- a/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
+++ b/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Hooks;
 
 use IContextSource;
 use RequestContext;
diff --git 
a/client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php 
b/client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php
index 163768d..e328348 100644
--- a/client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php
+++ b/client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Hooks;
 
 use FauxRequest;
 use Language;
@@ -12,6 +12,7 @@
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
+use Wikibase\Test\MockRepository;
 
 /**
  * @covers Wikibase\Client\Hooks\LanguageLinkBadgeDisplay
diff --git a/client/tests/phpunit/includes/hooks/MovePageNoticeTest.php 
b/client/tests/phpunit/includes/hooks/MovePageNoticeTest.php
index 0eebad3..61ba4d1 100644
--- a/client/tests/phpunit/includes/hooks/MovePageNoticeTest.php
+++ b/client/tests/phpunit/includes/hooks/MovePageNoticeTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Hooks;
 
 use Language;
 use Title;
diff --git 
a/client/tests/phpunit/includes/hooks/SpecialWatchlistQueryHandlerTest.php 
b/client/tests/phpunit/includes/hooks/SpecialWatchlistQueryHandlerTest.php
index ea390a4..e611f88 100644
--- a/client/tests/phpunit/includes/hooks

[MediaWiki-commits] [Gerrit] Change namespace of all Client Scribunto tests - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173797

Change subject: Change namespace of all Client Scribunto tests
..

Change namespace of all Client Scribunto tests

To be honest I'm not exactly sure ...

1.) if this is the correct schema. It seems there are at least two,
either Wikibase\Client\Module\Test or Wikibase\Client\Tests\Module.
2.) if it's considered good practice to move tests in individual
namespaces instead of a single Tests namespace for all of them.

Change-Id: I84d5b925a8ce1bad4348749599bda7d22071084e
---
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
M client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
M 
client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
M 
client/tests/phpunit/includes/scribunto/WikibaseLuaIntegrationTestItemSetUpHelper.php
7 files changed, 7 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/97/173797/1

diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
index e1dfeb4..a15344b 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
@@ -1,13 +1,12 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Scribunto;
 
 use Parser;
 use ParserOptions;
 use Scribunto;
 use Scribunto_LuaWikibaseEntityLibrary;
 use Title;
-use Wikibase\Client\Scribunto\Test\Scribunto_LuaWikibaseLibraryTestCase;
 use Wikibase\Client\WikibaseClient;
 
 /**
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
index b158e8c..776d779 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php
@@ -1,8 +1,6 @@
 ?php
 
-namespace Wikibase\Test;
-
-use Wikibase\Client\Scribunto\Test\Scribunto_LuaWikibaseLibraryTestCase;
+namespace Wikibase\Client\Tests\Scribunto;
 
 /**
  * Verifies that arbitrary data access doesn't work, if it's disabled.
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
index 985b973..0fbfd56 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php
@@ -1,13 +1,12 @@
 ?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests\Scribunto;
 
 use Parser;
 use ParserOptions;
 use Scribunto;
 use Scribunto_LuaWikibaseLibrary;
 use Title;
-use Wikibase\Client\Scribunto\Test\Scribunto_LuaWikibaseLibraryTestCase;
 use Wikibase\Client\WikibaseClient;
 
 /**
diff --git 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
index 34b2876..fe1fa43 100644
--- 
a/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
+++ 
b/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Client\Scribunto\Test;
+namespace Wikibase\Client\Tests\Scribunto;
 
 if ( !class_exists( 'Scribunto_LuaEngineTestBase' ) ) {
// This needs Scribunto
diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
index de0759b..b14df57 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Client\Scribunto\Test;
+namespace Wikibase\Client\Tests\Scribunto;
 
 use Language;
 use Wikibase\Client\Scribunto\WikibaseLuaBindings;
diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
index 43c5da6..4eb6f5e 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php
@@ -1,6 +1,6 @@
 ?php
 
-namespace Wikibase\Client\Scribunto\Test

[MediaWiki-commits] [Gerrit] Fix covers tag in WikibaseClientTest - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173819

Change subject: Fix covers tag in WikibaseClientTest
..

Fix covers tag in WikibaseClientTest

Found by Adrian in I9140582.

Change-Id: Ia0f3f192d09f984f69c393243860fdca0e61e347
---
M client/tests/phpunit/includes/WikibaseClientTest.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/19/173819/1

diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index c5fe016..27bb877 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -12,7 +12,7 @@
 use Wikibase\Test\MockSiteStore;
 
 /**
- * @covers Wikibase\Client\Changes\WikibaseClient
+ * @covers Wikibase\Client\WikibaseClient
  *
  * @group Wikibase
  * @group WikibaseClient

-- 
To view, visit https://gerrit.wikimedia.org/r/173819
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0f3f192d09f984f69c393243860fdca0e61e347
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Replace some Claims with StatementList - change (mediawiki...Wikibase)

2014-11-17 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173828

Change subject: Replace some Claims with StatementList
..

Replace some Claims with StatementList

I wanted to replace some usages of the Claims class but
immediatelly lost interest when I realized I would have to add
dozens, if not hundrets of these pointless wrappers:
new Statement( new Claim( ... ) ... )

This starts horrifying me. Code that has to use these classes
gets more and more messy. This is in no way better than simply
continuing to use Claim and Claims.

See https://github.com/wmde/WikibaseDataModel/pull/268

Similar problem with
new StatementList( array( ... ) )
It should accept a single statement.

Change-Id: Ia9ce8770e05da1477c082c9f345ffe596489f564
---
M lib/tests/phpunit/changes/TestChanges.php
M repo/includes/api/EditEntity.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php
3 files changed, 13 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/28/173828/1

diff --git a/lib/tests/phpunit/changes/TestChanges.php 
b/lib/tests/phpunit/changes/TestChanges.php
index 9ad8b8d..0a67909 100644
--- a/lib/tests/phpunit/changes/TestChanges.php
+++ b/lib/tests/phpunit/changes/TestChanges.php
@@ -6,7 +6,6 @@
 use Wikibase\ChangeRow;
 use Wikibase\ChangesTable;
 use Wikibase\DataModel\Claim\Claim;
-use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
@@ -15,6 +14,7 @@
 use Wikibase\DataModel\SiteLink;
 use Wikibase\DataModel\Snak\PropertyNoValueSnak;
 use Wikibase\DataModel\Statement\Statement;
+use Wikibase\DataModel\Statement\StatementList;
 use Wikibase\DiffChange;
 use Wikibase\EntityChange;
 use Wikibase\EntityFactory;
@@ -178,13 +178,13 @@
$statement = new Statement( new Claim( $snak ) );
$statement-setGuid( 'TEST$test-guid' );
 
-   $claims = new Claims( array( $statement ) );
-   $new-setClaims( $claims );
+   $statements = new StatementList( array( $statement ) );
+   $new-setStatements( $statements );
$changes['add-claim'] = $changeFactory-newFromUpdate( 
EntityChange::UPDATE, $old, $new );
$old = $new-copy();
 
-   $claims = new Claims();
-   $new-setClaims( $claims );
+   $statements = new StatementList();
+   $new-setStatements( $statements );
$changes['remove-claim'] = 
$changeFactory-newFromUpdate( EntityChange::UPDATE, $old, $new );
$old = $new-copy();
 
diff --git a/repo/includes/api/EditEntity.php b/repo/includes/api/EditEntity.php
index 5c36393..7972482 100644
--- a/repo/includes/api/EditEntity.php
+++ b/repo/includes/api/EditEntity.php
@@ -181,11 +181,6 @@
}
}
$entity-clear();
-
-   // bug 67791 (can be removed with DataModel 1.0)
-   if ( method_exists( $entity, 'setClaims' ) ) {
-   $entity-setClaims( new Claims() );
-   }
}
 
// if we create a new property, make sure we set the datatype
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php
index 33cd84d..b75ad29 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php
@@ -5,11 +5,13 @@
 use DataValues\StringValue;
 use InvalidArgumentException;
 use Wikibase\ChangeOp\ChangeOpStatementRank;
-use Wikibase\DataModel\Claim\Claims;
+use Wikibase\DataModel\Claim\Claim;
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\Statement;
+use Wikibase\DataModel\Statement\StatementList;
 use Wikibase\Lib\ClaimGuidGenerator;
 
 /**
@@ -80,15 +82,14 @@
$this-assertEquals( $rank, $expectedRank, No reference with 
expected hash );
}
 
-   private function newItemWithClaim( $itemIdString, $snak ) {
+   private function newItemWithClaim( $itemIdString, $mainSnak ) {
$item = Item::newEmpty();
$item-setId( new ItemId( $itemIdString ) );
 
-   $claim = $item-newClaim( $snak );
-   $claim-setGuid( $itemIdString . 
'$D8499CDA-25E4-4334-AG03-A3290BCD9CQP' );
-   $claims = new Claims();
-   $claims-addClaim( $claim );
-   $item-setClaims( $claims

[MediaWiki-commits] [Gerrit] Replace some deprecated setClaims with getStatements - change (mediawiki...Wikibase)

2014-11-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174109

Change subject: Replace some deprecated setClaims with getStatements
..

Replace some deprecated setClaims with getStatements

Change-Id: Ifb57318b61f7a9e9f11176aed56db14fdd2364c4
---
M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierRemoveTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpReferenceRemoveTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpReferenceTest.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpStatementRankTest.php
M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php
M repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php
M repo/tests/phpunit/includes/api/SetClaimTest.php
10 files changed, 58 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/09/174109/1

diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php
index 4026582..7fabcc2 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php
@@ -78,11 +78,12 @@
$item = Item::newEmpty();
$item-setId( new ItemId( $itemIdString ) );
 
-   $claim = $item-newClaim( $snak );
-   $claim-setGuid( $item-getId()-getSerialization() . 
'$D8404CDA-25E4-4334-AG93-A3290BCD9C0P' );
-   $claims = new Claims();
-   $claims-addClaim( $claim );
-   $item-setClaims( $claims );
+   $item-getStatements()-addNewStatement(
+   $snak,
+   null,
+   null,
+   $item-getId()-getSerialization() . 
'$D8404CDA-25E4-4334-AG93-A3290BCD9C0P'
+   );
 
return $item;
}
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php
index e600cbd..f8c0c10 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php
@@ -183,11 +183,12 @@
$item = Item::newEmpty();
$item-setId( new ItemId( $itemIdString ) );
 
-   $claim = $item-newClaim( $snak );
-   $claim-setGuid( 
$this-mockProvider-getGuidGenerator()-newGuid( $item-getId() ) );
-   $claims = new Claims();
-   $claims-addClaim( $claim );
-   $item-setClaims( $claims );
+   $item-getStatements()-addNewStatement(
+   $snak,
+   null,
+   null,
+   $this-mockProvider-getGuidGenerator()-newGuid( 
$item-getId() )
+   );
 
return $item;
}
diff --git 
a/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierRemoveTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierRemoveTest.php
index 4f6fd94..15349f1 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierRemoveTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierRemoveTest.php
@@ -81,13 +81,14 @@
$item = Item::newEmpty();
$item-setId( new ItemId( $itemIdString ) );
 
-   $claim = $item-newClaim( $snak );
-   $claim-setGuid( $itemIdString . 
'$D8404CDA-25E4-4334-AG03-A3290BCD9CQP' );
-   $claims = new Claims();
-   $claims-addClaim( $claim );
-   $item-setClaims( $claims );
+   $item-getStatements()-addNewStatement(
+   $snak,
+   null,
+   null,
+   $itemIdString . '$D8404CDA-25E4-4334-AG03-A3290BCD9CQP'
+   );
 
return $item;
}
 
-} 
\ No newline at end of file
+}
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php 
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php
index b861e2a..beb309e 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php
@@ -148,11 +148,12 @@
$item = Item::newEmpty();
$item-setId( 123 );
 
-   $claim = $item-newClaim( $snak );
-   $claim-setGuid( $item-getId()-getSerialization() . 
'$D8404CDA-25E4-4334-AG03-A3290BCD9CQP' );
-   $claims = new Claims();
-   $claims-addClaim( $claim );
-   $item-setClaims( $claims );
+   $item-getStatements

[MediaWiki-commits] [Gerrit] Reduce inheritance in EntityContentTest - change (mediawiki...Wikibase)

2014-11-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174110

Change subject: Reduce inheritance in EntityContentTest
..

Reduce inheritance in EntityContentTest

Especially the redirect stuff is only needed in ItemContentTest.

Change-Id: If76715ff5275c7ecb381413dd4f073aef0603b4e
---
M repo/includes/content/ItemContent.php
M repo/tests/phpunit/includes/content/EntityContentTest.php
M repo/tests/phpunit/includes/content/ItemContentTest.php
M repo/tests/phpunit/includes/content/PropertyContentTest.php
4 files changed, 58 insertions(+), 72 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/10/174110/1

diff --git a/repo/includes/content/ItemContent.php 
b/repo/includes/content/ItemContent.php
index 46cd222..4f59b97 100644
--- a/repo/includes/content/ItemContent.php
+++ b/repo/includes/content/ItemContent.php
@@ -3,15 +3,12 @@
 namespace Wikibase;
 
 use InvalidArgumentException;
-use Language;
 use LogicException;
 use MWException;
 use Title;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\Lib\Store\EntityRedirect;
 use Wikibase\Repo\ItemSearchTextGenerator;
-use Wikibase\Repo\View\ClaimsView;
-use Wikibase\Repo\View\FingerprintView;
 
 /**
  * Content object for articles representing Wikibase items.
diff --git a/repo/tests/phpunit/includes/content/EntityContentTest.php 
b/repo/tests/phpunit/includes/content/EntityContentTest.php
index 7028b28..e7b8b6c 100644
--- a/repo/tests/phpunit/includes/content/EntityContentTest.php
+++ b/repo/tests/phpunit/includes/content/EntityContentTest.php
@@ -69,45 +69,16 @@
}
 
/**
-* @return string
-*/
-   protected abstract function getContentClass();
-
-   /**
 * @return EntityId
 */
protected abstract function getDummyId();
 
/**
-* @param EntityId $id
+* @param EntityId $entityId
 *
 * @return EntityContent
 */
-   protected function newEmpty( EntityId $id = null ) {
-   $class = $this-getContentClass();
-   $empty = $class::newEmpty();
-
-   if ( $id ) {
-   $empty-getEntity()-setId( $id );
-   }
-
-   return $empty;
-   }
-
-   /**
-* @param EntityId $id
-* @param EntityId $target
-*
-* @return EntityContent
-*/
-   protected function newRedirect( EntityId $id, EntityId $target ) {
-   //FIXME: use the respective EntityHandler instead of going via 
the global title lookup!
-   $titleLookup = 
WikibaseRepo::getDefaultInstance()-getEntityTitleLookup();
-   $title = $titleLookup-getTitleForId( $target );
-
-   $class = $this-getContentClass();
-   return $class::newFromRedirect( new EntityRedirect( $id, 
$target ), $title );
-   }
+   protected abstract function newEmpty( EntityId $entityId = null );
 
/**
 * @dataProvider getTextForSearchIndexProvider
diff --git a/repo/tests/phpunit/includes/content/ItemContentTest.php 
b/repo/tests/phpunit/includes/content/ItemContentTest.php
index 7437fc1..c541520 100644
--- a/repo/tests/phpunit/includes/content/ItemContentTest.php
+++ b/repo/tests/phpunit/includes/content/ItemContentTest.php
@@ -8,7 +8,6 @@
 use Diff\DiffOp\DiffOpRemove;
 use Title;
 use Wikibase\DataModel\Claim\Claim;
-use Wikibase\DataModel\Claim\Claims;
 use Wikibase\DataModel\Entity\Diff\EntityDiff;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\ItemId;
@@ -21,6 +20,7 @@
 use Wikibase\ItemContent;
 use Wikibase\Lib\Store\EntityRedirect;
 use Wikibase\Repo\Content\EntityContentDiff;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\ItemContent
@@ -45,17 +45,39 @@
}
 
/**
-* @see EntityContentTest::getContentClass
-*/
-   protected function getContentClass() {
-   return '\Wikibase\ItemContent';
-   }
-
-   /**
-* @return EntityId
+* @return ItemId
 */
protected function getDummyId() {
return new ItemId( 'Q100' );
+   }
+
+   /**
+* @param EntityId $itemId
+*
+* @return ItemContent
+*/
+   protected function newEmpty( EntityId $itemId = null ) {
+   $empty = ItemContent::newEmpty();
+
+   if ( $itemId !== null ) {
+   $empty-getItem()-setId( $itemId );
+   }
+
+   return $empty;
+   }
+
+   /**
+* @param ItemId $itemId
+* @param ItemId $targetId
+*
+* @return ItemContent
+*/
+   private function newRedirect( ItemId $itemId, ItemId $targetId ) {
+   // FIXME: Use the respective EntityHandler instead of going via 
the global title lookup!
+   $titleLookup

[MediaWiki-commits] [Gerrit] Drop optional empty array() constructor parameters - change (mediawiki...Wikibase)

2014-11-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174112

Change subject: Drop optional empty array() constructor parameters
..

Drop optional empty array() constructor parameters

Change-Id: Ibf6405642110272aece50814c8a4259ffc7c346c
---
M lib/tests/phpunit/TermTest.php
M repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php
M 
repo/tests/phpunit/includes/Validators/LabelDescriptionUniquenessValidatorTest.php
M repo/tests/phpunit/includes/Validators/LabelUniquenessValidatorTest.php
M repo/tests/phpunit/includes/Validators/TermValidatorFactoryTest.php
M repo/tests/phpunit/includes/api/EntityTestHelper.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
7 files changed, 27 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/12/174112/1

diff --git a/lib/tests/phpunit/TermTest.php b/lib/tests/phpunit/TermTest.php
index a28dd9b..863deb1 100644
--- a/lib/tests/phpunit/TermTest.php
+++ b/lib/tests/phpunit/TermTest.php
@@ -82,8 +82,8 @@
$tests = array();
 
$tests[] = array( // #0
-   new Term( array() ),
-   new Term( array() ),
+   new Term(),
+   new Term(),
true
);
 
@@ -166,19 +166,19 @@
public static function provideEquals() {
$tests = array(
array( // #0
-   new Term( array() ),
+   new Term(),
null,
false
),
 
array( // #1
-   new Term( array() ),
+   new Term(),
false,
false
),
 
array( // #2
-   new Term( array() ),
+   new Term(),
,
false
),
diff --git 
a/repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php 
b/repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php
index fe84366..2479e8d 100644
--- 
a/repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php
+++ 
b/repo/tests/phpunit/includes/Validators/CompositeFingerprintValidatorTest.php
@@ -48,9 +48,9 @@
 */
public function testValidateFingerprint( $validators, $expected ) {
$fingerprint = new Fingerprint(
-   new TermList( array() ),
-   new TermList( array() ),
-   new AliasGroupList( array() )
+   new TermList(),
+   new TermList(),
+   new AliasGroupList()
);
 
$validator = new CompositeFingerprintValidator( $validators );
diff --git 
a/repo/tests/phpunit/includes/Validators/LabelDescriptionUniquenessValidatorTest.php
 
b/repo/tests/phpunit/includes/Validators/LabelDescriptionUniquenessValidatorTest.php
index 04bce91..45e5223 100644
--- 
a/repo/tests/phpunit/includes/Validators/LabelDescriptionUniquenessValidatorTest.php
+++ 
b/repo/tests/phpunit/includes/Validators/LabelDescriptionUniquenessValidatorTest.php
@@ -43,8 +43,8 @@
'no description' = array(
new Fingerprint(
new TermList( array( new Term( 'de', 
'DUPE' ) ) ),
-   new TermList( array() ),
-   new AliasGroupList( array() )
+   new TermList(),
+   new AliasGroupList()
),
$q99
),
@@ -52,7 +52,7 @@
new Fingerprint(
new TermList( array( new Term( 'de', 
'DUPE' ) ) ),
new TermList( array( new Term( 'de', 
'Foo' ) ) ),
-   new AliasGroupList( array() )
+   new AliasGroupList()
),
$q99
),
@@ -62,7 +62,7 @@
new Fingerprint(
new TermList( array( new Term( 'de', 
'DUPE' ) ) ),
new TermList( array( new Term( 'de', 
'DUPE' ) ) ),
-   new AliasGroupList( array() )
+   new AliasGroupList

[MediaWiki-commits] [Gerrit] More descriptive names for $repo variables and methods - change (mediawiki...Wikibase)

2014-11-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174123

Change subject: More descriptive names for $repo variables and methods
..

More descriptive names for $repo variables and methods

This is split from If6c96e0 to make it easier to review and find
out what makes jenkins fail.

Change-Id: I85e183b51cdc3d3f4870704de19e5f3242ff86fe
---
M client/includes/UpdateRepo/UpdateRepoOnMove.php
M client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
M repo/tests/phpunit/includes/EntityViewTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php
M repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php
M repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php
6 files changed, 38 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/23/174123/1

diff --git a/client/includes/UpdateRepo/UpdateRepoOnMove.php 
b/client/includes/UpdateRepo/UpdateRepoOnMove.php
index 319f249..272ca41 100644
--- a/client/includes/UpdateRepo/UpdateRepoOnMove.php
+++ b/client/includes/UpdateRepo/UpdateRepoOnMove.php
@@ -63,4 +63,5 @@
'user' = $this-user-getName()
);
}
+
 }
diff --git a/client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php 
b/client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
index 46fb334..0b58453 100644
--- a/client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
+++ b/client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php
@@ -105,16 +105,16 @@
}
 
/**
-* @param array[] $links
+* @param array[] $siteLinksPerItem
 *
 * @return MockRepository
 */
-   private function getMockRepo( $links ) {
+   private function getMockRepository( $siteLinksPerItem ) {
$repo = new MockRepository();
 
-   foreach ( $links as $itemKey = $itemLinks ) {
-   $itemId = new ItemId( $itemKey );
-   $item = $this-newItem( $itemId, $itemLinks );
+   foreach ( $siteLinksPerItem as $idString = $siteLinks ) {
+   $itemId = new ItemId( $idString );
+   $item = $this-newItem( $itemId, $siteLinks );
$repo-putEntity( $item );
}
 
@@ -165,7 +165,7 @@
private function newSidebarHookHandlers( array $settings = array() ) {
$badgeId = $this-getBadgeItem()-getId();
 
-   $links = array(
+   $siteLinksPerItem = array(
'Q1' = array(
new SiteLink( 'dewiki', 'Sauerstoff', array( 
$badgeId ) ),
new SiteLink( 'enwiki', 'Oxygen' ),
@@ -189,7 +189,7 @@
$namespaceChecker = new NamespaceChecker( array(), $namespaces 
);
$siteStore = $this-getSiteStore();
 
-   $mockRepo = $this-getMockRepo( $links );
+   $mockRepo = $this-getMockRepository( $siteLinksPerItem );
$mockRepo-putEntity( $this-getBadgeItem() );
 
$otherProjectsSidebarGenerator = new 
OtherProjectsSidebarGenerator(
diff --git a/repo/tests/phpunit/includes/EntityViewTest.php 
b/repo/tests/phpunit/includes/EntityViewTest.php
index 8030900..65917c9 100644
--- a/repo/tests/phpunit/includes/EntityViewTest.php
+++ b/repo/tests/phpunit/includes/EntityViewTest.php
@@ -48,7 +48,10 @@
  */
 abstract class EntityViewTest extends \MediaWikiLangTestCase {
 
-   protected static $mockRepo;
+   /**
+* @var MockRepository
+*/
+   private $mockRepository;
 
protected function newEntityIdParser() {
// The data provides use P123 and Q123 IDs, so the parser needs 
to understand these.
@@ -123,10 +126,10 @@
$languageFallbackChain = $factory-newFromLanguage( 
Language::factory( $langCode ) );
}
 
-   $mockRepo = $this-getMockRepo();
+   $mockRepository = $this-getMockRepository();
 
if ( !$entityInfoBuilderFactory ) {
-   $entityInfoBuilderFactory = $mockRepo;
+   $entityInfoBuilderFactory = $mockRepository;
}
 
if ( !$entityTitleLookup ) {
@@ -158,7 +161,7 @@
$entityView = new $class(
$context,
$snakFormatter,
-   $mockRepo,
+   $mockRepository,
$entityInfoBuilderFactory,
$entityTitleLookup,
$options,
@@ -179,25 +182,25 @@
return $options;
}
 
-   protected function getMockRepo() {
-   if ( !isset( self::$mockRepo ) ) {
-   $mockRepo = new

[MediaWiki-commits] [Gerrit] Fix entitysearch to support Firefox smart keyword - change (mediawiki...Wikibase)

2014-11-19 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174387

Change subject: Fix entitysearch to support Firefox smart keyword
..

Fix entitysearch to support Firefox smart keyword

Bug: 58467
Change-Id: I0216c9e35f1e2804cf6d6a75a6a0db45637b1726
---
M repo/resources/wikibase.ui.entitysearch.js
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/87/174387/1

diff --git a/repo/resources/wikibase.ui.entitysearch.js 
b/repo/resources/wikibase.ui.entitysearch.js
index 5461f22..94f085b 100644
--- a/repo/resources/wikibase.ui.entitysearch.js
+++ b/repo/resources/wikibase.ui.entitysearch.js
@@ -77,8 +77,7 @@
} );
 
$input
-   .removeAttr( 'name' )
-   .after( $hiddenInput );
+   .before( $hiddenInput );
 
$input
.one( 'focus', function( event ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/174387
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0216c9e35f1e2804cf6d6a75a6a0db45637b1726
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Implemented $.util.getDirectionality - change (mediawiki...Wikibase)

2014-12-18 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Implemented $.util.getDirectionality
..


Implemented $.util.getDirectionality

By acting as an interface to ULS, the function allows move ULS specifics out of 
the *view widgets.

Change-Id: I987843e00c06e1c5d5b7b9c7b2f25d9801441017
---
M lib/resources/jquery.wikibase/jquery.wikibase.descriptionview.js
M lib/resources/jquery.wikibase/jquery.wikibase.labelview.js
M lib/resources/jquery.wikibase/resources.php
M repo/resources/Resources.php
A repo/resources/jquery/jquery.util.getDirectionality.js
A repo/resources/jquery/resources.php
A repo/tests/qunit/jquery/jquery.util.getDirectionality.tests.js
A repo/tests/qunit/jquery/resources.php
M repo/tests/qunit/resources.php
9 files changed, 198 insertions(+), 61 deletions(-)

Approvals:
  Adrian Lang: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.descriptionview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.descriptionview.js
index eb91f78..8e00e8c 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.descriptionview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.descriptionview.js
@@ -125,17 +125,13 @@
return;
}
 
-   var dir = ( $.uls  $.uls.data ) ?
-   $.uls.data.getDir( languageCode ) :
-   $( 'html' ).prop( 'dir' );
-
var $input = $( 'input /', {
// TODO: Inject correct placeholder via options
placeholder: mw.msg(

'wikibase-description-edit-placeholder-language-aware',
wb.getLanguageNameByCode( languageCode )
),
-   dir: dir
+   dir: $.util.getDirectionality( languageCode )
} )
.on( 'eachchange.' + this.widgetName, function( event ) {
self._trigger( 'change' );
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.labelview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.labelview.js
index 4bfc1f4..01fd2c3 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.labelview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.labelview.js
@@ -140,17 +140,13 @@
return;
}
 
-   var dir = ( $.uls  $.uls.data ) ?
-   $.uls.data.getDir( languageCode ) :
-   $( 'html' ).prop( 'dir' );
-
var $input = $( 'input /', {
// TODO: Inject correct placeholder via options
placeholder: mw.msg(

'wikibase-label-edit-placeholder-language-aware',
wb.getLanguageNameByCode( languageCode )
),
-   dir: dir
+   dir: $.util.getDirectionality( languageCode )
} )
.on( 'eachchange.' + this.widgetName, function( event ) {
self._trigger( 'change' );
diff --git a/lib/resources/jquery.wikibase/resources.php 
b/lib/resources/jquery.wikibase/resources.php
index 485447c..123cd74 100644
--- a/lib/resources/jquery.wikibase/resources.php
+++ b/lib/resources/jquery.wikibase/resources.php
@@ -125,6 +125,7 @@
'dependencies' = array(
'jquery.inputautoexpand',
'jquery.ui.TemplatedWidget',
+   'jquery.util.getDirectionality',
'jquery.wikibase.edittoolbar',
'jquery.wikibase.toolbarcontroller',
'wikibase.datamodel.Term',
@@ -258,6 +259,7 @@
),
'dependencies' = array(
'jquery.ui.TemplatedWidget',
+   'jquery.util.getDirectionality',
'jquery.wikibase.edittoolbar',
'jquery.wikibase.toolbarcontroller',
'wikibase.datamodel.Term',
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index e94d91d..3479485 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -25,30 +25,6 @@
 
$modules = array(
 
-   'jquery.removeClassByRegex' = $moduleTemplate + array(
-   'scripts' = array(
-   'jquery/jquery.removeClassByRegex.js',
-   ),
-   ),
-
-   'jquery.sticknode' = $moduleTemplate + array(
-   'scripts' = array(
-   'jquery/jquery.sticknode.js

[MediaWiki-commits] [Gerrit] getDirectionality may return undefined - change (mediawiki...Wikibase)

2014-12-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180737

Change subject: getDirectionality may return undefined
..

getDirectionality may return undefined

Either this or change the doc to @return {string|undefined}.

Change-Id: I043376d0676d82d9052ee98478024dbe9e6f3a5a
---
M repo/resources/jquery/jquery.util.getDirectionality.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/37/180737/1

diff --git a/repo/resources/jquery/jquery.util.getDirectionality.js 
b/repo/resources/jquery/jquery.util.getDirectionality.js
index 6a3a746..d2edc26 100644
--- a/repo/resources/jquery/jquery.util.getDirectionality.js
+++ b/repo/resources/jquery/jquery.util.getDirectionality.js
@@ -15,7 +15,7 @@
  */
 $.util.getDirectionality = function( languageCode ) {
var dir = $.uls  $.uls.data ? $.uls.data.getDir( languageCode ) : $( 
'html' ).prop( 'dir' );
-   return dir !== '' ? dir : 'auto';
+   return dir ? dir : 'auto';
 };
 
 }( jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/180737
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I043376d0676d82d9052ee98478024dbe9e6f3a5a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Rework and clean up badge related code - change (mediawiki...Wikibase)

2014-12-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180760

Change subject: Rework and clean up badge related code
..

Rework and clean up badge related code

Change-Id: I268f60f5c9376016b7e8e982a4c2388da730f3c0
---
M lib/includes/serializers/SiteLinkSerializer.php
M repo/includes/ChangeOp/SiteLinkChangeOpFactory.php
M repo/includes/View/SiteLinksView.php
3 files changed, 33 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/60/180760/1

diff --git a/lib/includes/serializers/SiteLinkSerializer.php 
b/lib/includes/serializers/SiteLinkSerializer.php
index 9773753..5f48885 100644
--- a/lib/includes/serializers/SiteLinkSerializer.php
+++ b/lib/includes/serializers/SiteLinkSerializer.php
@@ -87,11 +87,12 @@
}
 
if ( !$setRemoved ) {
-   $badges = array();
-
-   foreach ( $siteLink-getBadges() as $badge ) {
-   $badges[] = $badge-getSerialization();
-   }
+   $badges = array_map(
+   function( ItemId $id ) {
+   return $id-getSerialization();
+   },
+   $siteLink-getBadges()
+   );
 
if ( $this-options-shouldIndexTags() ) {
$this-setIndexedTagName( $badges, 
'badge' );
diff --git a/repo/includes/ChangeOp/SiteLinkChangeOpFactory.php 
b/repo/includes/ChangeOp/SiteLinkChangeOpFactory.php
index 66914f0..186fa79 100644
--- a/repo/includes/ChangeOp/SiteLinkChangeOpFactory.php
+++ b/repo/includes/ChangeOp/SiteLinkChangeOpFactory.php
@@ -3,6 +3,7 @@
 namespace Wikibase\ChangeOp;
 
 use InvalidArgumentException;
+use Wikibase\DataModel\Entity\ItemId;
 
 /**
  * Factory for ChangeOps that modify SiteLinks.
@@ -15,12 +16,12 @@
/**
 * @param string $siteId
 * @param string $pageName
-* @param array|null $badges
+* @param ItemId[]|null $badges
 *
 * @throws InvalidArgumentException
 * @return ChangeOp
 */
-   public function newSetSiteLinkOp( $siteId, $pageName, $badges = array() 
) {
+   public function newSetSiteLinkOp( $siteId, $pageName, $badges = null ) {
return new ChangeOpSiteLink( $siteId, $pageName, $badges );
}
 
diff --git a/repo/includes/View/SiteLinksView.php 
b/repo/includes/View/SiteLinksView.php
index ae1a932..d7fb2c9 100644
--- a/repo/includes/View/SiteLinksView.php
+++ b/repo/includes/View/SiteLinksView.php
@@ -7,9 +7,9 @@
 use Sanitizer;
 use Site;
 use SiteList;
-use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
+use Wikibase\DataModel\Term\FingerprintProvider;
 use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Utils;
 
@@ -40,9 +40,9 @@
private $entityLookup;
 
/**
-* @var string
+* @var string[]
 */
-   private $languageCode;
+   private $badgeItems;
 
/**
 * @var string[]
@@ -50,10 +50,18 @@
private $specialSiteLinkGroups;
 
/**
-* @var array
+* @var string
 */
-   private $badgeItems;
+   private $languageCode;
 
+   /**
+* @param SiteList $sites
+* @param SectionEditLinkGenerator $sectionEditLinkGenerator
+* @param EntityLookup $entityLookup
+* @param string[] $badgeItems
+* @param string[] $specialSiteLinkGroups
+* @param string $languageCode
+*/
public function __construct(
SiteList $sites,
SectionEditLinkGenerator $sectionEditLinkGenerator,
@@ -317,7 +325,6 @@
private function getHtmlForBadges( SiteLink $siteLink ) {
$html = '';
 
-   /** @var ItemId $badge */
foreach ( $siteLink-getBadges() as $badge ) {
$serialization = $badge-getSerialization();
$classes = Sanitizer::escapeClass( $serialization );
@@ -339,22 +346,22 @@
 * Returns the title for the given badge id.
 * @todo use TermLookup when we have one
 *
-* @param EntityId $badgeId
+* @param ItemId $badgeId
 *
 * @return string
 */
-   private function getTitleForBadge( EntityId $badgeId ) {
-   $entity = $this-entityLookup-getEntity( $badgeId );
-   if ( $entity === null ) {
-   return $badgeId-getSerialization();
+   private function getTitleForBadge( ItemId $badgeId ) {
+   $badge = $this-entityLookup-getEntity( $badgeId

[MediaWiki-commits] [Gerrit] Refactoring of ChangeOpSiteLink - change (mediawiki...Wikibase)

2014-12-18 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/180762

Change subject: Refactoring of ChangeOpSiteLink
..

Refactoring of ChangeOpSiteLink

Change-Id: I94006953ede551aa9b301fa4f02a2afe8383b223
---
M repo/includes/ChangeOp/ChangeOpSiteLink.php
1 file changed, 56 insertions(+), 104 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/62/180762/1

diff --git a/repo/includes/ChangeOp/ChangeOpSiteLink.php 
b/repo/includes/ChangeOp/ChangeOpSiteLink.php
index 0cbe137..0375186 100644
--- a/repo/includes/ChangeOp/ChangeOpSiteLink.php
+++ b/repo/includes/ChangeOp/ChangeOpSiteLink.php
@@ -7,7 +7,7 @@
 use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\SiteLink;
+use Wikibase\DataModel\SiteLinkList;
 use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Summary;
 
@@ -19,40 +19,35 @@
  * @author Tobias Gritschacher  tobias.gritschac...@wikimedia.de 
  * @author Michał Łazowik
  * @author Bene*  benestar.wikime...@gmail.com 
+ * @author Thiemo Mättig
  */
 class ChangeOpSiteLink extends ChangeOpBase {
 
/**
-* @since 0.4
-*
 * @var string
 */
-   protected $siteId;
+   private $siteId;
 
/**
-* @since 0.4
-*
 * @var string|null
 */
-   protected $pageName;
+   private $pageName;
 
/**
-* @since 0.5
-*
 * @var ItemId[]|null
 */
-protected $badges;
+   private $badges;
 
/**
 * @since 0.4
 *
 * @param string $siteId
 * @param string|null $pageName Null to remove the sitelink (if $badges 
are also null)
-* @param array|null $badges Null for no-op
+* @param ItemId[]|null $badges Null for no-op
 *
 * @throws InvalidArgumentException
 */
-   public function __construct( $siteId, $pageName, $badges = null ) {
+   public function __construct( $siteId, $pageName, array $badges = null ) 
{
if ( !is_string( $siteId ) ) {
throw new InvalidArgumentException( '$siteId needs to 
be a string' );
}
@@ -61,14 +56,8 @@
throw new InvalidArgumentException( '$linkPage needs to 
be a string or null' );
}
 
-   if ( !is_array( $badges )  $badges !== null ) {
-   throw new InvalidArgumentException( '$badges need to be 
an array of ItemIds or null' );
-   }
-
if ( $badges !== null ) {
-   $this-validateBadges( $badges );
-
-   $badges = $this-removeDuplicateBadges( $badges );
+   $badges = $this-validateBadges( $badges );
}
 
$this-siteId = $siteId;
@@ -77,116 +66,80 @@
}
 
/**
-* @param array $badges
+* @param ItemId[] $badges
 *
 * @throws InvalidArgumentException
+* @return ItemId[]
 */
private function validateBadges( array $badges ) {
$badgeItems = 
WikibaseRepo::getDefaultInstance()-getSettings()-getSetting( 'badgeItems' );
+   $uniqueBadges = array();
 
-   foreach ( $badges as $badge ) {
-   if ( !( $badge instanceof ItemId ) ) {
-   throw new InvalidArgumentException( '$badge 
needs to be an ItemId' );
+   foreach ( $badges as $id ) {
+   if ( !( $id instanceof ItemId ) ) {
+   throw new InvalidArgumentException( '$badges 
needs to be an array of ItemId instances' );
}
 
-   if ( !array_key_exists( $badge-getSerialization(), 
$badgeItems ) ) {
-   throw new InvalidArgumentException( 'Only items 
specified in the config can be badges' );
+   if ( !array_key_exists( $id-getSerialization(), 
$badgeItems ) ) {
+   throw new InvalidArgumentException( 'Only items 
specified in the badgeItems setting can be badges' );
}
+
+   $uniqueBadges[$id-getSerialization()] = $id;
}
+
+   return array_values( $uniqueBadges );
}
 
/**
-* Removes duplicate badges from the array and returns the new list of 
badges.
-*
-* @param ItemId[] $badges
-*
-* @return ItemId[]
-*/
-   private function removeDuplicateBadges( array $badges ) {
-   $final = array();
-   foreach ( $badges as $badge ) {
-   if ( !$this-containsBadge( $final, $badge ) ) {
-   $final[] = $badge

[MediaWiki-commits] [Gerrit] Fix broken/missing @covers tags in Lib\Store - change (mediawiki...Wikibase)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/181050

Change subject: Fix broken/missing @covers tags in Lib\Store
..

Fix broken/missing @covers tags in Lib\Store

Change-Id: I11d5aef852ba960c53bdb7a35922627af492e874
---
M lib/tests/phpunit/store/EntityInfoTermLookupTest.php
M lib/tests/phpunit/store/EntityRedirectResolvingDecoratorTest.php
M lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php
M lib/tests/phpunit/store/EntityTermLookupTest.php
M lib/tests/phpunit/store/LanguageFallbackLabelLookupTest.php
M lib/tests/phpunit/store/LanguageLabelLookupTest.php
M lib/tests/phpunit/store/SiteLinkTableTest.php
M lib/tests/phpunit/store/SqlEntityInfoBuilderTest.php
8 files changed, 22 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/50/181050/1

diff --git a/lib/tests/phpunit/store/EntityInfoTermLookupTest.php 
b/lib/tests/phpunit/store/EntityInfoTermLookupTest.php
index 8d21862..c6046e5 100644
--- a/lib/tests/phpunit/store/EntityInfoTermLookupTest.php
+++ b/lib/tests/phpunit/store/EntityInfoTermLookupTest.php
@@ -11,7 +11,7 @@
  * @covers Wikibase\Lib\Store\EntityInfoTermLookup
  *
  * @licence GNU GPL v2+
- * @author Katie Filbert
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author Daniel Kinzler
  */
 class EntityInfoTermLookupTest extends \MediaWikiTestCase {
diff --git a/lib/tests/phpunit/store/EntityRedirectResolvingDecoratorTest.php 
b/lib/tests/phpunit/store/EntityRedirectResolvingDecoratorTest.php
index 45730ef..fc4c9ea 100644
--- a/lib/tests/phpunit/store/EntityRedirectResolvingDecoratorTest.php
+++ b/lib/tests/phpunit/store/EntityRedirectResolvingDecoratorTest.php
@@ -13,7 +13,7 @@
 use Wikibase\PropertyLabelResolver;
 
 /**
- * @covers Wikibase\Lib\Store\EntityRedirectResolver
+ * @covers Wikibase\Lib\Store\EntityRedirectResolvingDecorator
  *
  * @group WikibaseLib
  * @group Wikibase
diff --git a/lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php 
b/lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php
index cc22e93..7bc50bd 100644
--- a/lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php
+++ b/lib/tests/phpunit/store/EntityRetrievingTermLookupTest.php
@@ -6,6 +6,13 @@
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\Lib\Store\EntityRetrievingTermLookup;
 
+/**
+ * @covers Wikibase\Lib\Store\EntityRetrievingTermLookup
+ *
+ * @licence GNU GPL v2+
+ * @author Katie Filbert  aude.w...@gmail.com 
+ * @author Daniel Kinzler
+ */
 class EntityRetrievingTermLookupTest extends \PHPUnit_Framework_TestCase {
 
public function testGetLabel() {
diff --git a/lib/tests/phpunit/store/EntityTermLookupTest.php 
b/lib/tests/phpunit/store/EntityTermLookupTest.php
index 5fc8769..a6909b0 100644
--- a/lib/tests/phpunit/store/EntityTermLookupTest.php
+++ b/lib/tests/phpunit/store/EntityTermLookupTest.php
@@ -9,7 +9,7 @@
  * @covers Wikibase\Lib\Store\EntityTermLookup
  *
  * @licence GNU GPL v2+
- * @author Katie Filbert
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class EntityTermLookupTest extends \MediaWikiTestCase {
 
diff --git a/lib/tests/phpunit/store/LanguageFallbackLabelLookupTest.php 
b/lib/tests/phpunit/store/LanguageFallbackLabelLookupTest.php
index 386266e..68ffebb 100644
--- a/lib/tests/phpunit/store/LanguageFallbackLabelLookupTest.php
+++ b/lib/tests/phpunit/store/LanguageFallbackLabelLookupTest.php
@@ -7,9 +7,14 @@
 use Wikibase\Lib\Store\LanguageFallbackLabelLookup;
 
 /**
+ * @covers Wikibase\Lib\Store\LanguageFallbackLabelLookup
+ *
  * @group Wikibase
  * @group WikibaseLib
  * @group WikibaseStore
+ *
+ * @licence GNU GPL v2+
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class LanguageFallbackLabelLookupTest extends \MediaWikiTestCase {
 
diff --git a/lib/tests/phpunit/store/LanguageLabelLookupTest.php 
b/lib/tests/phpunit/store/LanguageLabelLookupTest.php
index 93a0c2b..f0f9a6c 100644
--- a/lib/tests/phpunit/store/LanguageLabelLookupTest.php
+++ b/lib/tests/phpunit/store/LanguageLabelLookupTest.php
@@ -7,9 +7,14 @@
 use Wikibase\Lib\Store\LanguageLabelLookup;
 
 /**
+ * @covers Wikibase\Lib\Store\LanguageLabelLookup
+ *
  * @group Wikibase
  * @group WikibaseLib
  * @group WikibaseStore
+ *
+ * @licence GNU GPL v2+
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class LanguageLabelLookupTest extends \MediaWikiTestCase {
 
diff --git a/lib/tests/phpunit/store/SiteLinkTableTest.php 
b/lib/tests/phpunit/store/SiteLinkTableTest.php
index a3f6b3e..d435e37 100644
--- a/lib/tests/phpunit/store/SiteLinkTableTest.php
+++ b/lib/tests/phpunit/store/SiteLinkTableTest.php
@@ -18,7 +18,7 @@
  *
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw  jeroended...@gmail.com 
- * @author aude
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class SiteLinkTableTest extends \MediaWikiTestCase {
 
diff --git a/lib/tests/phpunit/store/SqlEntityInfoBuilderTest.php

[MediaWiki-commits] [Gerrit] Fix broken emails in @author tags - change (mediawiki...Wikibase)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/181051

Change subject: Fix broken emails in @author tags
..

Fix broken emails in @author tags

... and use the same @author tag for Aude everywhere.

Change-Id: I7b1d4c57457d76aa5e7f45765d59e76bdbfeb230
---
M client/includes/LangLinkHandler.php
M lib/includes/ReferencedEntitiesFinder.php
M repo/includes/ItemDisambiguation.php
M repo/includes/View/SnakHtmlGenerator.php
M repo/tests/phpunit/includes/DefaultRepoSettingsTest.php
M repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php
M repo/tests/phpunit/includes/content/ItemContentTest.php
7 files changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/51/181051/1

diff --git a/client/includes/LangLinkHandler.php 
b/client/includes/LangLinkHandler.php
index 176aaa2..eb2af02 100644
--- a/client/includes/LangLinkHandler.php
+++ b/client/includes/LangLinkHandler.php
@@ -23,7 +23,7 @@
  * @licence GNU GPL v2+
  * @author Nikola Smolenski smole...@eunet.rs
  * @author Daniel Kinzler
- * @author Katie Filbert
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class LangLinkHandler {
 
diff --git a/lib/includes/ReferencedEntitiesFinder.php 
b/lib/includes/ReferencedEntitiesFinder.php
index 1fcd4be..b748abd 100644
--- a/lib/includes/ReferencedEntitiesFinder.php
+++ b/lib/includes/ReferencedEntitiesFinder.php
@@ -15,7 +15,7 @@
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw  jeroended...@gmail.com 
  * @author Daniel Werner  daniel.a.r.wer...@gmail.com 
- * @author Katie Filbert
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author Daniel Kinzler
  * @author Bene*  benestar.wikime...@gmail.com 
  */
diff --git a/repo/includes/ItemDisambiguation.php 
b/repo/includes/ItemDisambiguation.php
index 20f4ce6..ed3bd92 100644
--- a/repo/includes/ItemDisambiguation.php
+++ b/repo/includes/ItemDisambiguation.php
@@ -12,7 +12,7 @@
  * @since 0.5
  *
  * @licence GNU GPL v2+
- * @author aude
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author jeblad
  * @author Jeroen De Dauw  jeroended...@gmail.com 
  * @author Daniel Kinzler
diff --git a/repo/includes/View/SnakHtmlGenerator.php 
b/repo/includes/View/SnakHtmlGenerator.php
index 94bad93..b1f06df 100644
--- a/repo/includes/View/SnakHtmlGenerator.php
+++ b/repo/includes/View/SnakHtmlGenerator.php
@@ -17,7 +17,7 @@
  *
  * @author H. Snater  mediaw...@snater.com 
  * @author Pragunbhutani
- * @author Katie Filbert  aude.w...@gmail.com
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author Daniel Kinzler
  */
 class SnakHtmlGenerator {
diff --git a/repo/tests/phpunit/includes/DefaultRepoSettingsTest.php 
b/repo/tests/phpunit/includes/DefaultRepoSettingsTest.php
index bb8662d..e6a4074 100644
--- a/repo/tests/phpunit/includes/DefaultRepoSettingsTest.php
+++ b/repo/tests/phpunit/includes/DefaultRepoSettingsTest.php
@@ -9,7 +9,7 @@
  * @group WikibaseRepo
  *
  * @licence GNU GPL v2+
- * @author Katie Filbert  aude.w...@gamil.com 
+ * @author Katie Filbert  aude.w...@gmail.com 
  */
 class DefaultRepoSettingsTest extends \PHPUnit_Framework_TestCase {
 
diff --git a/repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php 
b/repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php
index cb70ca6..cfedcc5 100644
--- a/repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php
+++ b/repo/tests/phpunit/includes/View/SectionEditLinkGeneratorTest.php
@@ -12,7 +12,7 @@
  * @group EntityView
  *
  * @licence GNU GPL v2+
- * @author Katie Filbert
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author Daniel Kinzler
  * @author Adrian Lang
  */
diff --git a/repo/tests/phpunit/includes/content/ItemContentTest.php 
b/repo/tests/phpunit/includes/content/ItemContentTest.php
index 508c96c..f4c893f 100644
--- a/repo/tests/phpunit/includes/content/ItemContentTest.php
+++ b/repo/tests/phpunit/includes/content/ItemContentTest.php
@@ -35,7 +35,7 @@
  *
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw  jeroended...@gmail.com 
- * @author aude
+ * @author Katie Filbert  aude.w...@gmail.com 
  * @author Daniel Kinzler
  */
 class ItemContentTest extends EntityContentTest {

-- 
To view, visit https://gerrit.wikimedia.org/r/181051
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b1d4c57457d76aa5e7f45765d59e76bdbfeb230
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Suggester visibility depend on spinner visibility - change (mediawiki...Wikibase)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/181056

Change subject: Suggester visibility depend on spinner visibility
..

Suggester visibility depend on spinner visibility

This fixes the issue of the spinner not becoming visible.

There is an other problem: this._term is empty _after_ I typed the
first character. But I think this patch can be merged independent
from this issue.

Change-Id: I0295ec9d15608089f3686ae9f3c63cea76a1aba9
---
M repo/resources/jquery.wikibase/jquery.wikibase.entitysearch.js
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/56/181056/1

diff --git a/repo/resources/jquery.wikibase/jquery.wikibase.entitysearch.js 
b/repo/resources/jquery.wikibase/jquery.wikibase.entitysearch.js
index c18c727..5e55c00 100644
--- a/repo/resources/jquery.wikibase/jquery.wikibase.entitysearch.js
+++ b/repo/resources/jquery.wikibase/jquery.wikibase.entitysearch.js
@@ -103,11 +103,13 @@
 * @see jQuery.ui.suggester._updateMenuVisibility
 */
_updateMenuVisibility: function() {
-   if( !this._term.length ) {
-   this._close();
-   } else {
+   if( this._term || ( this.options.suggestionsPlaceholder
+this.options.suggestionsPlaceholder.getVisibility() )
+   ) {
this._open();
this.repositionMenu();
+   } else {
+   this._close();
}
},
 

-- 
To view, visit https://gerrit.wikimedia.org/r/181056
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0295ec9d15608089f3686ae9f3c63cea76a1aba9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add/correct comments in SpecialListDatatypes.php - change (mediawiki...Wikibase)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Add/correct comments in SpecialListDatatypes.php
..


Add/correct comments in SpecialListDatatypes.php

Adds comments for missing messages or ones that has been renamed.

Change-Id: I6e43504e203686c53a4958d1e2bcc2a88abfe071
---
M repo/includes/specials/SpecialListDatatypes.php
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/repo/includes/specials/SpecialListDatatypes.php 
b/repo/includes/specials/SpecialListDatatypes.php
index 087256e..d1b8674 100644
--- a/repo/includes/specials/SpecialListDatatypes.php
+++ b/repo/includes/specials/SpecialListDatatypes.php
@@ -30,10 +30,12 @@
// some of the datatype descriptions
// 'wikibase-listdatatypes-wikibase-item-head'
// 'wikibase-listdatatypes-wikibase-item-body'
+   // 'wikibase-listdatatypes-wikibase-property-head'
+   // 'wikibase-listdatatypes-wikibase-property-body'
// 'wikibase-listdatatypes-commonsmedia-head'
// 'wikibase-listdatatypes-commonsmedia-body'
-   // 'wikibase-listdatatypes-geo-coordinate-head'
-   // 'wikibase-listdatatypes-geo-coordinate-body'
+   // 'wikibase-listdatatypes-globe-coordinate-head'
+   // 'wikibase-listdatatypes-globe-coordinate-body'
// 'wikibase-listdatatypes-quantity-head'
// 'wikibase-listdatatypes-quantity-body'
// 'wikibase-listdatatypes-monolingualtext-head'
@@ -41,7 +43,11 @@
// 'wikibase-listdatatypes-multilingualtext-head'
// 'wikibase-listdatatypes-multilingualtext-body'
// 'wikibase-listdatatypes-time-head'
-   // 'wikibase-listdatatypes-text-body'
+   // 'wikibase-listdatatypes-time-body'
+   // 'wikibase-listdatatypes-string-head'
+   // 'wikibase-listdatatypes-string-body'
+   // 'wikibase-listdatatypes-url-head'
+   // 'wikibase-listdatatypes-url-body'
 
foreach ( $this-getDataTypeIds() as $dataTypeId ) {
$this-getOutput()-addHTML( 
$this-getHtmlForDataTypeId( $dataTypeId ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/181061
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6e43504e203686c53a4958d1e2bcc2a88abfe071
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Unicodesnowman ad...@glados.cc
Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Added type checks to wikibase.api.RepoApi functions - change (mediawiki...WikibaseJavaScriptApi)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Added type checks to wikibase.api.RepoApi functions
..


Added type checks to wikibase.api.RepoApi functions

Actually reflecting parameter documentation in the code instead of relying on 
the back-end handling.
This resolves some wrong documentation as well.
Added tests testing the minimum of parameters required by each function.

Change-Id: I4d043f5cc43852970a489014bc5c106592ccfdc3
---
M .jshintrc
M README.md
M src/RepoApi.js
A tests/.jshintrc
M tests/RepoApi.tests.js
5 files changed, 557 insertions(+), 149 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/.jshintrc b/.jshintrc
index 09f9407..239b121 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,52 +1,52 @@
 {
-   bitwise : true, // Prohibit bitwise operators (, |, ^, etc.).
+   bitwise: true, // Prohibit bitwise operators (, |, ^, etc.).
camelcase: true, // Force variable names to be camelcase
-   curly : true, // Require {} for every new block or scope.
-   eqeqeq : true, // Require triple equals i.e. `===`.
+   curly: true, // Require {} for every new block or scope.
+   eqeqeq: true, // Require triple equals i.e. `===`.
es3: true, // Prohibit trailing comma in object literals (breaks 
older versions of IE)
-   forin : false, // Don't expect `for in` loops to call 
`hasOwnPrototype`.
+   forin: false, // Don't expect `for in` loops to call 
`hasOwnPrototype`.
freeze: true, // Prohibit overwriting prototypes of native objects 
such as Array, Date and so on.
-   immed : true, // Require immediate invocations to be wrapped in 
parens e.g. `( function(){}() );`
-   latedef : true, // Prohibit variable use before definition.
-   newcap : true, // Require capitalization of all constructor functions 
e.g. `new F()`.
-   noarg : true, // Prohibit use of `arguments.caller` and 
`arguments.callee`.
-   noempty : true, // Prohibit use of empty blocks.
+   immed: true, // Require immediate invocations to be wrapped in parens 
e.g. `( function(){}() );`
+   latedef: true, // Prohibit variable use before definition.
+   newcap: true, // Require capitalization of all constructor functions 
e.g. `new F()`.
+   noarg: true, // Prohibit use of `arguments.caller` and 
`arguments.callee`.
+   noempty: true, // Prohibit use of empty blocks.
nonbsp: true, // Prohibit nbsp
-   nonew : true, // Prohibit use of constructors for side-effects.
-   plusplus : false, // Allow use of `++`  `--`.
-   regexp : true, // Prohibit `.` and `[^...]` in regular expressions.
-   undef : true, // Require all non-global variables be declared before 
they are used.
-   unused : false, // Don't warn about unused variables
-   strict : true, // Require `use strict` pragma in every file.
-   trailing : true, // Prohibit trailing whitespaces.
+   nonew: true, // Prohibit use of constructors for side-effects.
+   plusplus: false, // Allow use of `++`  `--`.
+   regexp: true, // Prohibit `.` and `[^...]` in regular expressions.
+   undef: true, // Require all non-global variables be declared before 
they are used.
+   unused: false, // Don't warn about unused variables
+   strict: true, // Require `use strict` pragma in every file.
+   trailing: true, // Prohibit trailing whitespaces.
 
-   asi : false, // Don't tolerate Automatic Semicolon Insertion (no 
semicolons).
-   boss : false, // Don't tolerate assignments inside if, for  while. 
Usually conditions  loops are for comparison, not assignments.
-   debug : false, // Don't allow debugger statements e.g. browser 
breakpoints.
-   eqnull : false, // Don't tolerate use of `== null`.
-   es5 : false, // Don't allow EcmaScript 5 syntax.
-   esnext : false, // Don't allow ES.next specific features such as 
`const` and `let`.
-   evil : false, // Don't tolerate use of `eval`.
-   expr : false, // Don't tolerate `ExpressionStatement` as Programs.
-   funcscope : false, // Don't tolerate declarations of variables inside 
of control structures while accessing them later from the outside.
-   globalstrict : false, // Don't allow global use strict (also 
enables 'strict').
-   iterator : false, // Don't allow usage of __iterator__ property.
-   lastsemic : false, // Don't tolerat missing semicolons when the it is 
omitted for the last statement in a one-line block.
-   laxbreak : true, // Tolerate unsafe line breaks e.g. `return [\n] x` 
without semicolons.
-   laxcomma : false, // Don't suppress warnings about comma-first coding 
style.
-   loopfunc : false, // Don't allow functions to be defined within loops.
-   multistr : false, // Don't tolerate multi-line strings.
-   onecase : false, // Don't tolerate switches with just one

[MediaWiki-commits] [Gerrit] Added RepoApi tests for functions not yet tested - change (mediawiki...WikibaseJavaScriptApi)

2014-12-19 Thread WMDE
Thiemo Mättig (WMDE) has submitted this change and it was merged.

Change subject: Added RepoApi tests for functions not yet tested
..


Added RepoApi tests for functions not yet tested

Change-Id: I2e45bbfdcae0cb378a376dd9ff635e1fe080378f
---
M README.md
M tests/RepoApi.tests.js
2 files changed, 326 insertions(+), 40 deletions(-)

Approvals:
  Thiemo Mättig (WMDE): Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index fcbef2c..f2f54c4 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@
  Enhancements
 * Updated code documentation to be able to generate documentation using JSDuck.
 * `wikibase.api.RepoApi` QUnit tests have been rewritten to not execute actual 
API requests anymore.
+* Added `wikibase.api.RepoApi` QUnit tests for functions not yet tested.
 
 ### Bugfixes
 * An empty `Entity` may be created by omitting the `data` parameter on 
`wikibase.api.RepoApi.createEntity()` again.
diff --git a/tests/RepoApi.tests.js b/tests/RepoApi.tests.js
index df88a68..bea05e1 100644
--- a/tests/RepoApi.tests.js
+++ b/tests/RepoApi.tests.js
@@ -112,6 +112,143 @@
assert.equal( getParam( mock.spy, 'data' ), JSON.stringify( data ) );
 } );
 
+QUnit.test( 'formatValue()', function( assert ) {
+   var mock = mockApi( 'get' );
+
+   mock.api.formatValue(
+   { datavalue: 'serialization' },
+   { option: 'option value'},
+   'data type id',
+   'output format'
+   );
+
+   assert.ok( mock.spy.calledOnce, 'Triggered API call.' );
+
+   assert.equal(
+   getParam( mock.spy, 'action' ),
+   'wbformatvalue',
+   'Verified API module being called.'
+   );
+
+   assert.equal(
+   getParam( mock.spy, 'datavalue' ),
+   JSON.stringify( { datavalue: 'serialization' } )
+   );
+   assert.equal( getParam( mock.spy, 'options' ), JSON.stringify( { 
option: 'option value'} ) );
+   assert.equal( getParam( mock.spy, 'datatype' ), 'data type id' );
+   assert.equal( getParam( mock.spy, 'generate' ), 'output format' );
+} );
+
+QUnit.test( 'getEntities()', function( assert ) {
+   var mock = mockApi( 'get' );
+
+   mock.api.getEntities(
+   ['entity id 1', 'entity id 2'],
+   ['property1', 'property2'],
+   ['language code 1', 'language code 2'],
+   ['sort property 1', 'sort property 2'],
+   'sort direction'
+   );
+
+   mock.api.getEntities(
+   'entity id',
+   'property',
+   'language code',
+   'sort property',
+   'sort direction'
+   );
+
+   assert.ok( mock.spy.calledTwice, 'Triggered API calls.' );
+
+   assert.equal(
+   getParam( mock.spy, 'action' ),
+   'wbgetentities',
+   'Verified API module being called.'
+   );
+
+   assert.equal( getParam( mock.spy, 'ids' ), 'entity id 1|entity id 2' );
+   assert.equal( getParam( mock.spy, 'props' ), 'property1|property2' );
+   assert.equal( getParam( mock.spy, 'languages' ), 'language code 
1|language code 2' );
+   assert.equal( getParam( mock.spy, 'sort' ), 'sort property 1|sort 
property 2' );
+   assert.equal( getParam( mock.spy, 'dir' ), 'sort direction' );
+
+   assert.equal( getParam( mock.spy, 'ids', 1 ), 'entity id' );
+   assert.equal( getParam( mock.spy, 'props', 1 ), 'property' );
+   assert.equal( getParam( mock.spy, 'languages', 1 ), 'language code' );
+   assert.equal( getParam( mock.spy, 'sort', 1 ), 'sort property' );
+   assert.equal( getParam( mock.spy, 'dir', 1 ), 'sort direction' );
+} );
+
+QUnit.test( 'getEntitiesByPage()', function( assert ) {
+   var mock = mockApi( 'get' );
+
+   mock.api.getEntitiesByPage(
+   ['site id 1', 'site id 2'],
+   ['title1', 'title2'],
+   ['property1', 'property2'],
+   ['language code 1', 'language code 2'],
+   ['sort property 1', 'sort property 2'],
+   'sort direction',
+   true
+   );
+
+   mock.api.getEntitiesByPage(
+   'site id',
+   'title',
+   'property',
+   'language code',
+   'sort property',
+   'sort direction',
+   false
+   );
+
+   assert.ok( mock.spy.calledTwice, 'Triggered API calls.' );
+
+   assert.equal(
+   getParam( mock.spy, 'action' ),
+   'wbgetentities',
+   'Verified API module being called.'
+   );
+
+   assert.equal( getParam( mock.spy, 'sites' ), 'site id 1|site id 2' );
+   assert.equal( getParam( mock.spy, 'titles' ), 'title1|title2' );
+   assert.equal( getParam( mock.spy, 'props' ), 'property1|property2' );
+   assert.equal( getParam( mock.spy, 'languages

  1   2   3   4   5   6   7   8   9   10   >