Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/225344
Change subject: Decrease PHPCS line length limit to 145
......................................................................
Decrease PHPCS line length limit to 145
Now in steps of 5, to make the patches small and easy to review.
Change-Id: Iaa75d9a0a642ddd7a6f13cc27f7b0c8c513e1f1f
---
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/DataAccess/SnaksFinderTest.php
M lib/tests/phpunit/StringNormalizerTest.php
M lib/tests/phpunit/store/EntityInfoBuilderTest.php
M phpcs.xml
M repo/includes/rdf/SimpleValueRdfBuilder.php
M repo/includes/specials/SpecialSetSiteLink.php
M repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
M
repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
M repo/tests/phpunit/includes/actions/EditEntityActionTest.php
M repo/tests/phpunit/includes/api/MergeItemsTest.php
12 files changed, 158 insertions(+), 47 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/44/225344/1
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index 3402b6f..d3e0e61 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
@@ -193,30 +193,36 @@
),
'sitelink usage' => array(
array( EntityUsage::SITELINK_USAGE ),
- array( ChangeHandler::LINKS_UPDATE_ACTION,
ChangeHandler::PARSER_PURGE_ACTION, ChangeHandler::WEB_PURGE_ACTION,
ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::LINKS_UPDATE_ACTION,
ChangeHandler::PARSER_PURGE_ACTION,
+ ChangeHandler::WEB_PURGE_ACTION,
ChangeHandler::RC_ENTRY_ACTION ),
),
'label usage' => array(
array( EntityUsage::LABEL_USAGE ),
- array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION, ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION,
+ ChangeHandler::RC_ENTRY_ACTION ),
array( ChangeHandler::LINKS_UPDATE_ACTION )
),
'title usage' => array(
array( EntityUsage::TITLE_USAGE ),
- array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION, ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION,
+ ChangeHandler::RC_ENTRY_ACTION ),
array( ChangeHandler::LINKS_UPDATE_ACTION )
),
'other usage' => array(
array( EntityUsage::OTHER_USAGE ),
- array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION, ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION,
+ ChangeHandler::RC_ENTRY_ACTION ),
array( ChangeHandler::LINKS_UPDATE_ACTION )
),
'all usage' => array(
array( EntityUsage::ALL_USAGE ),
- array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION, ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::PARSER_PURGE_ACTION,
ChangeHandler::WEB_PURGE_ACTION,
+ ChangeHandler::RC_ENTRY_ACTION ),
),
'sitelink and other usage (does links update)' => array(
array( EntityUsage::SITELINK_USAGE,
EntityUsage::OTHER_USAGE ),
- array( ChangeHandler::LINKS_UPDATE_ACTION,
ChangeHandler::PARSER_PURGE_ACTION, ChangeHandler::WEB_PURGE_ACTION,
ChangeHandler::RC_ENTRY_ACTION ),
+ array( ChangeHandler::LINKS_UPDATE_ACTION,
ChangeHandler::PARSER_PURGE_ACTION,
+ ChangeHandler::WEB_PURGE_ACTION,
ChangeHandler::RC_ENTRY_ACTION ),
),
);
}
diff --git a/client/tests/phpunit/includes/DataAccess/SnaksFinderTest.php
b/client/tests/phpunit/includes/DataAccess/SnaksFinderTest.php
index 77eb3e1..a882514 100644
--- a/client/tests/phpunit/includes/DataAccess/SnaksFinderTest.php
+++ b/client/tests/phpunit/includes/DataAccess/SnaksFinderTest.php
@@ -28,7 +28,12 @@
/**
* @dataProvider findSnaksProvider
*/
- public function testFindSnaks( array $expected, StatementListProvider
$statementListProvider, PropertyId $propertyId, $acceptableRanks = null ) {
+ public function testFindSnaks(
+ array $expected,
+ StatementListProvider $statementListProvider,
+ PropertyId $propertyId,
+ array $acceptableRanks = null
+ ) {
$snaksFinder = new SnaksFinder();
$snakList = $snaksFinder->findSnaks( $statementListProvider,
$propertyId, $acceptableRanks );
diff --git a/lib/tests/phpunit/StringNormalizerTest.php
b/lib/tests/phpunit/StringNormalizerTest.php
index 7e19e66..a646766 100644
--- a/lib/tests/phpunit/StringNormalizerTest.php
+++ b/lib/tests/phpunit/StringNormalizerTest.php
@@ -87,8 +87,14 @@
array( "foo\rbar", 'foo bar'), // #5, both a space and
control char
array( "\r \t\nfoo\r\t\t\tbar\n\n\n\r\r", 'foo bar'),
// #6, both space and control chars
array( "\r \t\nfoo\r\t\t\t bar\n\n\n\r\r", 'foo bar'),
// #7, both space and control chars
- array( html_entity_decode( "foo‌bar", ENT_QUOTES,
"utf-8"), html_entity_decode( "foo‌bar", ENT_QUOTES, "utf-8") ), // #8
- array( html_entity_decode( "foo‌‌bar",
ENT_QUOTES, "utf-8"), html_entity_decode( "foo‌‌bar", ENT_QUOTES,
"utf-8") ), // #9
+ array(
+ html_entity_decode( 'foo‌bar',
ENT_QUOTES, 'utf-8' ),
+ html_entity_decode( 'foo‌bar',
ENT_QUOTES, 'utf-8' )
+ ),
+ array(
+ html_entity_decode( 'foo‌‌bar',
ENT_QUOTES, 'utf-8' ),
+ html_entity_decode( 'foo‌‌bar',
ENT_QUOTES, 'utf-8' )
+ ),
);
}
diff --git a/lib/tests/phpunit/store/EntityInfoBuilderTest.php
b/lib/tests/phpunit/store/EntityInfoBuilderTest.php
index 36b41c1..41d96e0 100644
--- a/lib/tests/phpunit/store/EntityInfoBuilderTest.php
+++ b/lib/tests/phpunit/store/EntityInfoBuilderTest.php
@@ -206,16 +206,26 @@
null,
array(
'Q1' => array( 'id' => 'Q1', 'type' =>
Item::ENTITY_TYPE,
- 'labels' =>
$this->makeLanguageValueRecords( array( 'en' => 'label:Q1/en', 'de' =>
'label:Q1/de' ) ),
- 'descriptions' =>
$this->makeLanguageValueRecords( array( 'en' => 'description:Q1/en', 'de' =>
'description:Q1/de' ) ),
- 'aliases' =>
$this->makeLanguageValueRecords( array( 'en' => array( 'alias:Q1/en#1' ), 'de'
=> array( 'alias:Q1/de#1', 'alias:Q1/de#2' ) ) ),
+ 'labels' =>
$this->makeLanguageValueRecords( array(
+ 'en' => 'label:Q1/en',
'de' => 'label:Q1/de' ) ),
+ 'descriptions' =>
$this->makeLanguageValueRecords( array(
+ 'en' =>
'description:Q1/en', 'de' => 'description:Q1/de' ) ),
+ 'aliases' =>
$this->makeLanguageValueRecords( array(
+ 'en' => array(
'alias:Q1/en#1' ),
+ 'de' => array(
'alias:Q1/de#1', 'alias:Q1/de#2' ) ) ),
),
'P3' => array( 'id' => 'P3', 'type' =>
Property::ENTITY_TYPE,
- 'labels' =>
$this->makeLanguageValueRecords( array( 'en' => 'label:P3/en', 'de' =>
'label:P3/de' ) ),
- 'descriptions' =>
$this->makeLanguageValueRecords( array( 'en' => 'description:P3/en', 'de' =>
'description:P3/de' ) ),
- 'aliases' => array(),
+ 'labels' =>
$this->makeLanguageValueRecords( array(
+ 'en' => 'label:P3/en',
'de' => 'label:P3/de' ) ),
+ 'descriptions' =>
$this->makeLanguageValueRecords( array(
+ 'en' =>
'description:P3/en', 'de' => 'description:P3/de' ) ),
+ 'aliases' => array(),
),
- 'Q7' => array( 'id' => 'Q7', 'type' =>
Item::ENTITY_TYPE, 'labels' => array(), 'descriptions' => array(), 'aliases' =>
array() ),
+ 'Q7' => array( 'id' => 'Q7', 'type' =>
Item::ENTITY_TYPE,
+ 'labels' => array(),
+ 'descriptions' => array(),
+ 'aliases' => array()
+ ),
)
),
diff --git a/phpcs.xml b/phpcs.xml
index 74018d4..867c33b 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -14,7 +14,7 @@
<rule ref="Generic.Files.LineLength">
<properties>
<!-- TODO: Should be decreased to 100, preferably in
steps of 10. -->
- <property name="lineLimit" value="150" />
+ <property name="lineLimit" value="145" />
<property name="absoluteLineLimit" value="9999" />
</properties>
<!-- Exclude auto-generated files from the Translate extension,
see magic-export.php. -->
diff --git a/repo/includes/rdf/SimpleValueRdfBuilder.php
b/repo/includes/rdf/SimpleValueRdfBuilder.php
index a5de19a..91d0135 100644
--- a/repo/includes/rdf/SimpleValueRdfBuilder.php
+++ b/repo/includes/rdf/SimpleValueRdfBuilder.php
@@ -148,7 +148,8 @@
}
// TODO: add special handling like in WDTK?
- //
https://github.com/Wikidata/Wikidata-Toolkit/blob/master/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/extensions/SimpleIdExportExtension.java
+ //
https://github.com/Wikidata/Wikidata-Toolkit/blob/master/wdtk-rdf/src/main/java/org/
+ // wikidata/wdtk/rdf/extensions/SimpleIdExportExtension.java
}
/**
diff --git a/repo/includes/specials/SpecialSetSiteLink.php
b/repo/includes/specials/SpecialSetSiteLink.php
index f09591b..ed0793a 100644
--- a/repo/includes/specials/SpecialSetSiteLink.php
+++ b/repo/includes/specials/SpecialSetSiteLink.php
@@ -108,8 +108,12 @@
$parts = ( $subPage === '' ) ? array() : explode( '/',
$subPage, 2 );
// check if id belongs to an item
- if ( $this->entityRevision !== null && !(
$this->entityRevision->getEntity() instanceof Item ) ) {
- $this->showErrorHTML( $this->msg(
'wikibase-setsitelink-not-item',
$this->entityRevision->getEntity()->getId()->getSerialization() )->parse() );
+ if ( $this->entityRevision !== null
+ && !( $this->entityRevision->getEntity() instanceof
Item )
+ ) {
+ $itemId = $this->entityRevision->getEntity()->getId();
+ $msg = $this->msg( 'wikibase-setsitelink-not-item',
$itemId->getSerialization() );
+ $this->showErrorHTML( $msg->parse() );
$this->entityRevision = null;
}
diff --git a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
index a4be925..cfd7505 100644
--- a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
+++ b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php
@@ -136,11 +136,18 @@
new DiffOpChange(
Statement::RANK_NORMAL, Statement::RANK_PREFERRED )
),
new Statement( new PropertyValueSnak( new
PropertyId( 'P1' ), new StringValue( 'foo' ) ) ),
- '<tr><td colspan="2"
class="diff-lineno">property / P1: foo / rank</td><td colspan="2"
class="diff-lineno">property / P1: foo / rank</td></tr>'.
- '<tr><td class="diff-marker">-</td><td
class="diff-deletedline">'.
- '<div><del class="diffchange
diffchange-inline"><span>Normal rank</span></del></div></td>'.
- '<td class="diff-marker">+</td><td
class="diff-addedline">'.
- '<div><ins class="diffchange
diffchange-inline"><span>Preferred rank</span></ins></div></td></tr>'
+ '<tr>'
+ . '<td colspan="2" class="diff-lineno">property
/ P1: foo / rank</td>'
+ . '<td colspan="2" class="diff-lineno">property
/ P1: foo / rank</td>'
+ . '</tr>'
+ . '<tr>'
+ . '<td class="diff-marker">-</td><td
class="diff-deletedline"><div>'
+ . '<del class="diffchange
diffchange-inline"><span>Normal rank</span></del>'
+ . '</div></td>'
+ . '<td class="diff-marker">+</td><td
class="diff-addedline"><div>'
+ . '<ins class="diffchange
diffchange-inline"><span>Preferred rank</span></ins>'
+ . '</div></td>'
+ . '</tr>'
),
'mainsnak and qualifiers' => array(
new ClaimDifference(
diff --git
a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
index 07d0ba4..548616a 100644
--- a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
+++ b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
@@ -223,7 +223,10 @@
array( 'aliases' => array( "nl" => array( array(
"language" => "nl", "value" => "Ali1" ) ) ) ),
array( 'aliases' => array( "nl" => array( array(
"language" => "nl", "value" => "Ali2" ) ) ) ),
array(),
- array( 'aliases' => array( "nl" => array( array(
"language" => "nl", "value" => "Ali2" ), array( "language" => "nl", "value" =>
"Ali1" ) ) ) ),
+ array( 'aliases' => array( 'nl' => array(
+ array( 'language' => 'nl', 'value' => 'Ali2' ),
+ array( 'language' => 'nl', 'value' => 'Ali1' )
+ ) ) ),
);
$testCases['sitelinksMerge'] = array(
array( 'sitelinks' => array( 'dewiki' => array( 'site'
=> 'dewiki', 'title' => 'Foo' ) ) ),
@@ -271,10 +274,18 @@
array(),
array( 'claims' => array(
'P1' => array(
- array( 'mainsnak' => array( 'snaktype'
=> 'value', 'property' => 'P1', 'datavalue' => array( 'value' => 'imastring2',
'type' => 'string' ) ),
- 'type' => 'statement', 'rank'
=> 'normal' ),
- array( 'mainsnak' => array( 'snaktype'
=> 'value', 'property' => 'P1', 'datavalue' => array( 'value' => 'imastring1',
'type' => 'string' ) ),
- 'type' => 'statement', 'rank'
=> 'normal' )
+ array(
+ 'mainsnak' => array( 'snaktype'
=> 'value', 'property' => 'P1',
+ 'datavalue' => array(
'value' => 'imastring2', 'type' => 'string' ) ),
+ 'type' => 'statement',
+ 'rank' => 'normal'
+ ),
+ array(
+ 'mainsnak' => array( 'snaktype'
=> 'value', 'property' => 'P1',
+ 'datavalue' => array(
'value' => 'imastring1', 'type' => 'string' ) ),
+ 'type' => 'statement',
+ 'rank' => 'normal'
+ )
)
) ),
);
diff --git
a/repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
b/repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
index 4967072..8cecd0b 100644
---
a/repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
+++
b/repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php
@@ -32,9 +32,21 @@
) );
return array(
- 'ChangeOpValidationException(0)' => array( new
ChangeOpValidationException( $result0 ), 'wikibase-validator-invalid', array()
),
- 'ChangeOpValidationException(1)' => array( new
ChangeOpValidationException( $result1 ), 'wikibase-validator-too-long', array(
'8' ) ),
- 'ChangeOpValidationException(2)' => array( new
ChangeOpValidationException( $result2 ), 'wikibase-validator-too-long', array(
'eekwiki|Eek' ) ),
+ 'ChangeOpValidationException(0)' => array(
+ new ChangeOpValidationException( $result0 ),
+ 'wikibase-validator-invalid',
+ array()
+ ),
+ 'ChangeOpValidationException(1)' => array(
+ new ChangeOpValidationException( $result1 ),
+ 'wikibase-validator-too-long',
+ array( '8' )
+ ),
+ 'ChangeOpValidationException(2)' => array(
+ new ChangeOpValidationException( $result2 ),
+ 'wikibase-validator-too-long',
+ array( 'eekwiki|Eek' )
+ ),
);
}
diff --git a/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
b/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
index d7fee42..23e9547 100644
--- a/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
+++ b/repo/tests/phpunit/includes/actions/EditEntityActionTest.php
@@ -624,11 +624,19 @@
* @param WikiPage|Title|string $page
* @param array $params
* @param bool $post
- * @param User $user
- * @param null $htmlPattern
- * @param null $expectedProps
+ * @param User|null $user
+ * @param string|bool|null $htmlPattern
+ * @param string[]|null $expectedProps
*/
- protected function tryUndoAction( $action, $page, array $params, $post
= false, User $user = null, $htmlPattern = null, $expectedProps = null ) {
+ protected function tryUndoAction(
+ $action,
+ $page,
+ array $params,
+ $post = false,
+ User $user = null,
+ $htmlPattern = null,
+ $expectedProps = null
+ ) {
if ( $user ) {
$this->setUser( $user );
}
diff --git a/repo/tests/phpunit/includes/api/MergeItemsTest.php
b/repo/tests/phpunit/includes/api/MergeItemsTest.php
index c2c15d5..1db6ef9 100644
--- a/repo/tests/phpunit/includes/api/MergeItemsTest.php
+++ b/repo/tests/phpunit/includes/api/MergeItemsTest.php
@@ -293,34 +293,75 @@
return array(
array( //0 no ids given
'p' => array(),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'param-missing' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'param-missing'
+ ) )
+ ),
array( //1 only from id
'p' => array( 'fromid' => 'Q1' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'param-missing' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'param-missing'
+ ) )
+ ),
array( //2 only to id
'p' => array( 'toid' => 'Q1' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'param-missing' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'param-missing'
+ ) )
+ ),
array( //3 toid bad
'p' => array( 'fromid' => 'Q1', 'toid' =>
'ABCDE' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'invalid-entity-id' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'invalid-entity-id'
+ ) )
+ ),
array( //4 fromid bad
'p' => array( 'fromid' => 'ABCDE', 'toid' =>
'Q1' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'invalid-entity-id' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'invalid-entity-id'
+ ) )
+ ),
array( //5 both same id
'p' => array( 'fromid' => 'Q1', 'toid' => 'Q1'
),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'invalid-entity-id', 'message' => 'You must provide
unique ids' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'invalid-entity-id',
+ 'message' => 'You must provide unique
ids'
+ ) )
+ ),
array( //6 from id is property
'p' => array( 'fromid' => 'P1', 'toid' => 'Q1'
),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'not-item' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'not-item'
+ ) )
+ ),
array( //7 to id is property
'p' => array( 'fromid' => 'Q1', 'toid' => 'P1'
),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'not-item' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'not-item'
+ ) )
+ ),
array( //8 bad ignoreconficts
'p' => array( 'fromid' => 'Q2', 'toid' => 'Q2',
'ignoreconflicts' => 'foo' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'invalid-entity-id' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'invalid-entity-id'
+ ) )
+ ),
array( //9 bad ignoreconficts
'p' => array( 'fromid' => 'Q2', 'toid' => 'Q2',
'ignoreconflicts' => 'label|foo' ),
- 'e' => array( 'exception' => array( 'type' =>
'UsageException', 'code' => 'invalid-entity-id' ) ) ),
+ 'e' => array( 'exception' => array(
+ 'type' => 'UsageException',
+ 'code' => 'invalid-entity-id'
+ ) )
+ ),
);
}
--
To view, visit https://gerrit.wikimedia.org/r/225344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa75d9a0a642ddd7a6f13cc27f7b0c8c513e1f1f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits