jenkins-bot has submitted this change and it was merged. Change subject: Set PHPCS' LineLength sniff to 170 characters ......................................................................
Set PHPCS' LineLength sniff to 170 characters This patch decreases the line length from 200 to 170 characters and fixes all code that exceeds this limit. I'm also doing a little bit of additional fixes in closely related code, most notably: * Add the missing space at the end of some array() calls. * Fix the only class that breaks the NotCamelCaps rule. * Add an exception for the Scribunto_LuaWikibase... classes. Change-Id: I5f5a81b2db4f9f464ff9f34195bcefc870417f33 --- M client/WikibaseClient.i18n.magic.php M phpcs.xml M repo/includes/api/CreateClaim.php M repo/maintenance/importProperties.php M repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/api/EditEntityTest.php M repo/tests/phpunit/includes/api/SetSiteLinkTest.php M repo/tests/phpunit/includes/rdf/ComplexValueRdfBuilderTest.php M view/tests/phpunit/SiteLinksViewTest.php 9 files changed, 606 insertions(+), 163 deletions(-) Approvals: Addshore: Looks good to me, approved jenkins-bot: Verified diff --git a/client/WikibaseClient.i18n.magic.php b/client/WikibaseClient.i18n.magic.php index ddfb492..ac62caf 100644 --- a/client/WikibaseClient.i18n.magic.php +++ b/client/WikibaseClient.i18n.magic.php @@ -85,7 +85,11 @@ /** Hindi (हिन्दी) */ $magicWords['hi'] = array( - 'noexternallanglinks' => array( 0, 'कोई_अंतरविकी_कड़ियाँ_नहीं', 'कोई_अंतरविकि_कड़ियाँ_नहीं' ), + 'noexternallanglinks' => array( + 0, + 'कोई_अंतरविकी_कड़ियाँ_नहीं', + 'कोई_अंतरविकि_कड़ियाँ_नहीं' + ), 'property' => array( 0, 'गुण' ), ); diff --git a/phpcs.xml b/phpcs.xml index 4d6c360..e08e01b 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -14,7 +14,7 @@ <rule ref="Generic.Files.LineLength"> <properties> <!-- FIXME: Should be decreased to 100, preferably in steps of 10. --> - <property name="lineLimit" value="200" /> + <property name="lineLimit" value="170" /> <property name="absoluteLineLimit" value="9999" /> </properties> </rule> @@ -53,10 +53,9 @@ <rule ref="PSR2.ControlStructures.ElseIfDeclaration" /> <rule ref="PSR2.Methods.MethodDeclaration" /> - <!-- TODO: Enable Squiz sniffs. --> - <!-- FIXME: This indicates an error in the Wikibase codebase that should be fixed. --> <rule ref="Squiz.Classes.ValidClassName.NotCamelCaps"> - <severity>0</severity> + <!-- FIXME: This indicates an error in the Wikibase codebase that should be fixed. --> + <exclude-pattern>DataAccess*Scribunto*Scribunto_LuaWikibase*Library</exclude-pattern> </rule> <rule ref="Squiz.ControlStructures.ControlSignature" /> <!-- FIXME: This indicates an error in the Wikibase codebase that should be fixed. --> diff --git a/repo/includes/api/CreateClaim.php b/repo/includes/api/CreateClaim.php index 6201315..0805506 100644 --- a/repo/includes/api/CreateClaim.php +++ b/repo/includes/api/CreateClaim.php @@ -157,9 +157,12 @@ =>'apihelp-wbcreateclaim-example-1', 'action=wbcreateclaim&entity=Q42&property=P9002&snaktype=value&value="itsastring"' => 'apihelp-wbcreateclaim-example-2', - 'action=wbcreateclaim&entity=Q42&property=P9003&snaktype=value&value={"entity-type":"item","numeric-id":1}' + 'action=wbcreateclaim&entity=Q42&property=P9003&snaktype=value&value=' + . '{"entity-type":"item","numeric-id":1}' => 'apihelp-wbcreateclaim-example-3', - 'action=wbcreateclaim&entity=Q42&property=P9004&snaktype=value&value={"latitude":40.748433,"longitude":-73.985656,"globe":"http://www.wikidata.org/entity/Q2","precision":0.000001}' + 'action=wbcreateclaim&entity=Q42&property=P9004&snaktype=value&value=' + . '{"latitude":40.748433,"longitude":-73.985656,' + . '"globe":"http://www.wikidata.org/entity/Q2","precision":0.000001}' => 'apihelp-wbcreateclaim-example-4', ); } diff --git a/repo/maintenance/importProperties.php b/repo/maintenance/importProperties.php index 28f010c..d2ed96a 100644 --- a/repo/maintenance/importProperties.php +++ b/repo/maintenance/importProperties.php @@ -1,5 +1,10 @@ <?php +namespace Wikibase; + +use Exception; +use Maintenance; +use User; use Wikibase\DataModel\Entity\Property; use Wikibase\Lib\Store\EntityStore; use Wikibase\Repo\WikibaseRepo; @@ -24,7 +29,7 @@ require_once $basePath . '/maintenance/Maintenance.php'; -class importProperties extends Maintenance { +class ImportProperties extends Maintenance { /** * @var bool @@ -192,5 +197,5 @@ } -$maintClass = 'importProperties'; +$maintClass = 'Wikibase\ImportProperties'; require_once RUN_MAINTENANCE_IF_MAIN; diff --git a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php index be0b101..a4be925 100644 --- a/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php +++ b/repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php @@ -227,7 +227,10 @@ '<td class="diff-marker">+</td><td class="diff-addedline">'. '<div><ins class="diffchange diffchange-inline"><span>newmainsnakvalue (DETAILED)</span></ins></div></td></tr>'. // rank change - '<tr><td colspan="2" class="diff-lineno">property / P1: oldmainsnakvalue / rank</td><td colspan="2" class="diff-lineno">property / P1: newmainsnakvalue / rank</td></tr>'. + '<tr>' . + '<td colspan="2" class="diff-lineno">property / P1: oldmainsnakvalue / rank</td>' . + '<td colspan="2" class="diff-lineno">property / P1: newmainsnakvalue / 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">'. diff --git a/repo/tests/phpunit/includes/api/EditEntityTest.php b/repo/tests/phpunit/includes/api/EditEntityTest.php index e308dec..24edd80 100644 --- a/repo/tests/phpunit/includes/api/EditEntityTest.php +++ b/repo/tests/phpunit/includes/api/EditEntityTest.php @@ -233,26 +233,31 @@ ) ), 'add a claim' => array( - 'p' => array( 'data' => '{"claims":[{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":{"value":"imastring","type":"string"}},"type":"statement","rank":"normal"}]}' ), + 'p' => array( 'data' => '{"claims":[{"mainsnak":{"snaktype":"value",' + . '"property":"%P56%","datavalue":{"value":"imastring","type":"string"}},' + . '"type":"statement","rank":"normal"}]}' ), 'e' => array( 'claims' => array( '%P56%' => array( - 'mainsnak' => array( 'snaktype' => 'value', 'property' => '%P56%', - 'datavalue' => array( - 'value' => 'imastring', - 'type' => 'string' ) ), + 'mainsnak' => array( + 'snaktype' => 'value', + 'property' => '%P56%', + 'datavalue' => array( 'value' => 'imastring', 'type' => 'string' ) + ), 'type' => 'statement', - 'rank' => 'normal' ) ) ) ), - + 'rank' => 'normal' + ) + ) ) + ), 'change the claim' => array( 'p' => array( 'data' => array( 'claims' => array( array( 'id' => '%lastClaimId%', 'mainsnak' => array( - 'snaktype' => 'value', - 'property' => '%P56%', - 'datavalue' => array( 'value' => 'diffstring', 'type' => 'string' ), - ), + 'snaktype' => 'value', + 'property' => '%P56%', + 'datavalue' => array( 'value' => 'diffstring', 'type' => 'string' ), + ), 'type' => 'statement', 'rank' => 'normal', ), @@ -265,16 +270,21 @@ 'value' => 'diffstring', 'type' => 'string' ) ), 'type' => 'statement', - 'rank' => 'normal' ) ) ) ), - + 'rank' => 'normal' + ) + ) ) + ), 'remove the claim' => array( 'p' => array( 'data' => '{"claims":[{"id":"%lastClaimId%","remove":""}]}' ), - 'e' => array( 'claims' => array() ) ), - + 'e' => array( 'claims' => array() ) + ), 'add multiple claims' => array( - 'p' => array( - 'data' => '{"claims":[{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":{"value":"imastring1","type":"string"}},"type":"statement","rank":"normal"},' . - '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":{"value":"imastring2","type":"string"}},"type":"statement","rank":"normal"}]}' ), + 'p' => array( 'data' => '{"claims":[' + . '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":' + . '{"value":"imastring1","type":"string"}},"type":"statement","rank":"normal"},' + . '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":' + . '{"value":"imastring2","type":"string"}},"type":"statement","rank":"normal"}' + . ']}' ), 'e' => array( 'claims' => array( array( 'mainsnak' => array( @@ -302,15 +312,20 @@ 'aliases' => array(), 'sitelinks' => array(), 'claims' => array() - ) ), - + ) + ), 'add lots of data again' => array( - 'p' => array( - 'data' => '{"claims":[{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":{"value":"imastring1","type":"string"}},"type":"statement","rank":"normal"},' . - '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":{"value":"imastring2","type":"string"}},"type":"statement","rank":"normal"}],' . - '"sitelinks":{"dewiki":{"site":"dewiki","title":"page"}},"labels":{"en":{"language":"en","value":"A Label"}},"descriptions":{"en":{"language":"en","value":"A description"}}}' ), - 'e' => array( 'type' => 'item' ) ), - + 'p' => array( 'data' => '{"claims":[' + . '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":' + . '{"value":"imastring1","type":"string"}},"type":"statement","rank":"normal"},' + . '{"mainsnak":{"snaktype":"value","property":"%P56%","datavalue":' + . '{"value":"imastring2","type":"string"}},"type":"statement","rank":"normal"}' + . '],' + . '"sitelinks":{"dewiki":{"site":"dewiki","title":"page"}},' + . '"labels":{"en":{"language":"en","value":"A Label"}},' + . '"descriptions":{"en":{"language":"en","value":"A description"}}}' ), + 'e' => array( 'type' => 'item' ) + ), 'remove all stuff in another way' => array( 'p' => array( 'clear' => true, 'data' => '{}' ), 'e' => array( @@ -319,8 +334,8 @@ 'aliases' => array(), 'sitelinks' => array(), 'claims' => array() - ) ), - + ) + ), ); } @@ -401,19 +416,19 @@ public function provideExceptionData() { return array( 'no entity id given' => array( // no entity id given - 'p' => array( 'id' => '', 'data' => '{}'), + 'p' => array( 'id' => '', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity-id' ) ) ), 'invalid id' => array( // invalid id - 'p' => array( 'id' => 'abcde', 'data' => '{}'), + 'p' => array( 'id' => 'abcde', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity-id' ) ) ), 'invalid explicit id' => array( // invalid explicit id - 'p' => array( 'id' => '1234', 'data' => '{}'), + 'p' => array( 'id' => '1234', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity-id' ) ) ), 'non existent sitelink' => array( // non existent sitelink - 'p' => array( 'site' => 'dewiki','title' => 'NonExistent', 'data' => '{}'), + 'p' => array( 'site' => 'dewiki','title' => 'NonExistent', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity-link' ) ) ), 'missing site (also bad title)' => array( // missing site (also bad title) - 'p' => array( 'title' => 'abcde', 'data' => '{}'), + 'p' => array( 'title' => 'abcde', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'param-missing' ) ) ), 'cant have id and new' => array( // cant have id and new 'p' => array( 'id' => 'q666', 'new' => 'item', 'data' => '{}' ), @@ -422,7 +437,7 @@ 'p' => array( 'site' => 'enwiki', 'new' => 'Berlin', 'clear' => '' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'nodata' ) ) ), 'bad site' => array( // bad site - 'p' => array( 'site' => 'abcde', 'data' => '{}'), + 'p' => array( 'site' => 'abcde', 'data' => '{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'unknown_site' ) ) ), 'no data provided' => array( 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' ), @@ -432,42 +447,75 @@ ) ) ), 'malformed json' => array( // malformed json - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{{{}'), + 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{{{}' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'invalid-json' ) ) ), 'must be a json object (json_decode s this an an int)' => array( // must be a json object (json_decode s this an an int) - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '1234'), + 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '1234' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized-array' ) ) ), 'must be a json object (json_decode s this an an indexed array)' => array( // must be a json object (json_decode s this an an indexed array) - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '[ "xyz" ]'), + 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '[ "xyz" ]' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized-string' ) ) ), 'must be a json object (json_decode s this an a string)' => array( // must be a json object (json_decode s this an a string) - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '"string"'), + 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '"string"' ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized-array' ) ) ), 'inconsistent site in json' => array( // inconsistent site in json - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{"sitelinks":{"ptwiki":{"site":"svwiki","title":"TestPage!"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"ptwiki":{"site":"svwiki","title":"TestPage!"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'inconsistent-site' ) ) ), 'inconsistent lang in json' => array( // inconsistent lang in json - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{"labels":{"de":{"language":"pt","value":"TestPage!"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"labels":{"de":{"language":"pt","value":"TestPage!"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'inconsistent-language' ) ) ), 'inconsistent unknown site in json' => array( // inconsistent unknown site in json - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{"sitelinks":{"BLUB":{"site":"BLUB","title":"TestPage!"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"BLUB":{"site":"BLUB","title":"TestPage!"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized-site' ) ) ), 'inconsistent unknown languages' => array( // inconsistent unknown languages - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{"lables":{"BLUB":{"language":"BLUB","value":"ImaLabel"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"lables":{"BLUB":{"language":"BLUB","value":"ImaLabel"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized' ) ) ), //@todo the error codes in the overly long string tests make no sense and should be corrected... 'overly long label' => array( // overly long label - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , - 'data' => '{"lables":{"en":{"language":"en","value":"'.TermTestHelper::makeOverlyLongString().'"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"lables":{"en":{"language":"en","value":"' + . TermTestHelper::makeOverlyLongString() . '"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), 'overly long description' => array( // overly long description - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , - 'data' => '{"descriptions":{"en":{"language":"en","value":"'.TermTestHelper::makeOverlyLongString().'"}}}'), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"descriptions":{"en":{"language":"en","value":"' + . TermTestHelper::makeOverlyLongString() . '"}}}' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), //@todo add check for Bug:52731 once fixed 'removing invalid claim fails' => array( // removing invalid claim fails - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin' , 'data' => '{"claims":[{"remove":""}]}'), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'invalid-claim', 'message' => 'Cannot remove a claim with no GUID' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"claims":[{"remove":""}]}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'invalid-claim', + 'message' => 'Cannot remove a claim with no GUID' + ) ) + ), 'removing valid claim with no guid fails' => array( 'p' => array( 'site' => 'enwiki', @@ -485,28 +533,88 @@ } ] }' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-recognized', 'message' => 'Unknown key in json: remove' ) ) ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'not-recognized', + 'message' => 'Unknown key in json: remove' ) + ) + ), 'bad badge id' => array( // bad badge id - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!","badges":["abc","%Q149%"]}}}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'invalid-entity-id' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!",' + . '"badges":["abc","%Q149%"]}}}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'invalid-entity-id' + ) ) + ), 'badge id is not an item id' => array( // badge id is not an item id - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!","badges":["P2","%Q149%"]}}}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'invalid-entity-id' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!",' + . '"badges":["P2","%Q149%"]}}}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'invalid-entity-id' + ) ) + ), 'badge id is not specified' => array( // badge id is not specified - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!","badges":["%Q149%","%Q32%"]}}}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'not-badge' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!",' + . '"badges":["%Q149%","%Q32%"]}}}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'not-badge' + ) ) + ), 'badge item does not exist' => array( // badge item does not exist - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!","badges":["Q99999","%Q149%"]}}}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"dewiki":{"site":"dewiki","title":"TestPage!",' + . '"badges":["Q99999","%Q149%"]}}}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'no-such-entity' + ) ) + ), 'no sitelink - cannot change badges' => array( // no sitelink - cannot change badges - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'data' => '{"sitelinks":{"svwiki":{"site":"svwiki","badges":["%Q42%","%Q149%"]}}}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-sitelink' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'data' => '{"sitelinks":{"svwiki":{"site":"svwiki",' + . '"badges":["%Q42%","%Q149%"]}}}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'no-such-sitelink' + ) ) + ), 'bad id in serialization' => array( - 'p' => array( 'id' => '%Berlin%', 'data' => '{"id":"Q13244"}'), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'param-invalid', 'message' => 'Invalid field used in call: "id", must match id parameter' ) ) ), + 'p' => array( 'id' => '%Berlin%', 'data' => '{"id":"Q13244"}' ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'param-invalid', + 'message' => 'Invalid field used in call: "id", must match id parameter' + ) ) + ), 'bad type in serialization' => array( - 'p' => array( 'id' => '%Berlin%', 'data' => '{"id":"%Berlin%","type":"foobar"}'), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'param-invalid', 'message' => 'Invalid field used in call: "type", must match type associated with id' ) ) ), + 'p' => array( 'id' => '%Berlin%', 'data' => '{"id":"%Berlin%","type":"foobar"}' ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'param-invalid', + 'message' => 'Invalid field used in call: "type", must match type associated with id' + ) ) + ), 'bad main snak replacement' => array( 'p' => array( 'id' => '%Berlin%', 'data' => json_encode( array( 'claims' => array( diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php index 4acfdd0..3b1cf6f 100644 --- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php @@ -47,92 +47,313 @@ public function provideData() { return array( array( //0 set new link using id - 'p' => array( 'handle' => 'Leipzig', 'linksite' => 'dewiki', 'linktitle' => 'leipzig', 'badges' => '{gaItem}|{faItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Leipzig', 'badges' => array( '{gaItem}', '{faItem}' ) ) ) ) ), + 'p' => array( + 'handle' => 'Leipzig', + 'linksite' => 'dewiki', + 'linktitle' => 'leipzig', + 'badges' => '{gaItem}|{faItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Leipzig', + 'badges' => array( '{gaItem}', '{faItem}' ) + ) ) + ) + ), array( //1 set new link using sitelink - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'nowiki', 'linktitle' => 'berlin' ), - 'e' => array( 'value' => array( 'nowiki' => array( 'title' => 'Berlin', 'badges' => array() ) ), 'indb' => 5 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'nowiki', + 'linktitle' => 'berlin' + ), + 'e' => array( + 'value' => array( 'nowiki' => array( + 'title' => 'Berlin', + 'badges' => array() + ) ), + 'indb' => 5 + ) + ), array( //2 modify link using id - 'p' => array( 'handle' => 'Leipzig', 'linksite' => 'dewiki', 'linktitle' => 'Leipzig_Two', 'badges' => '' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Leipzig Two', 'badges' => array() ) ) ) ), + 'p' => array( + 'handle' => 'Leipzig', + 'linksite' => 'dewiki', + 'linktitle' => 'Leipzig_Two', + 'badges' => '' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Leipzig Two', + 'badges' => array() + ) ) + ) + ), array( //3 modify link using sitelink - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'nowiki', 'linktitle' => 'Berlin_Two' ), - 'e' => array( 'value' => array( 'nowiki' => array( 'title' => 'Berlin Two', 'badges' => array() ) ), 'indb' => 5 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'nowiki', + 'linktitle' => 'Berlin_Two' + ), + 'e' => array( + 'value' => array( 'nowiki' => array( + 'title' => 'Berlin Two', + 'badges' => array() + ) ), + 'indb' => 5 + ) + ), array( //4 remove link using id (with a summary) - 'p' => array( 'handle' => 'Leipzig', 'linksite' => 'dewiki', 'linktitle' => '', 'summary' => 'WooSummary' ), + 'p' => array( + 'handle' => 'Leipzig', + 'linksite' => 'dewiki', + 'linktitle' => '', + 'summary' => 'WooSummary' + ), 'e' => array( 'value' => array() ) ), array( //5 remove link using sitelink - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'nowiki', 'linktitle' => '' ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'nowiki', + 'linktitle' => '' + ), 'e' => array( 'value' => array(), 'indb' => 4 ) ), array( //6 add badges to existing sitelink - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'dewiki', 'linktitle' => 'Berlin', 'badges' => '{faItem}|{gaItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin', 'badges' => array( '{faItem}', '{gaItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'dewiki', + 'linktitle' => 'Berlin', + 'badges' => '{faItem}|{gaItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin', + 'badges' => array( '{faItem}', '{gaItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //7 add duplicate badges to existing sitelink - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'dewiki', 'linktitle' => 'Berlin', 'badges' => '{gaItem}|{gaItem}|{faItem}|{gaItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin', 'badges' => array( '{gaItem}', '{faItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'dewiki', + 'linktitle' => 'Berlin', + 'badges' => '{gaItem}|{gaItem}|{faItem}|{gaItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin', + 'badges' => array( '{gaItem}', '{faItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //8 no change - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'dewiki', 'linktitle' => 'Berlin', 'badges' => '{gaItem}|{faItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin', 'badges' => array( '{gaItem}', '{faItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'dewiki', + 'linktitle' => 'Berlin', + 'badges' => '{gaItem}|{faItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin', + 'badges' => array( '{gaItem}', '{faItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //9 change only title, badges should be intact - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'dewiki', 'linktitle' => 'Berlin_Two' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin Two', 'badges' => array( '{gaItem}', '{faItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'dewiki', + 'linktitle' => 'Berlin_Two' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin Two', + 'badges' => array( '{gaItem}', '{faItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //10 change both title and badges - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin Two', 'linksite' => 'dewiki', 'linktitle' => 'Berlin', 'badges' => '{gaItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin', 'badges' => array( '{gaItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin Two', + 'linksite' => 'dewiki', + 'linktitle' => 'Berlin', + 'badges' => '{gaItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin', + 'badges' => array( '{gaItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //11 change only badges, title intact - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'dewiki', 'badges' => '{gaItem}|{faItem}' ), - 'e' => array( 'value' => array( 'dewiki' => array( 'title' => 'Berlin', 'badges' => array( '{gaItem}', '{faItem}' ) ) ), 'indb' => 4 ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'dewiki', + 'badges' => '{gaItem}|{faItem}' + ), + 'e' => array( + 'value' => array( 'dewiki' => array( + 'title' => 'Berlin', + 'badges' => array( '{gaItem}', '{faItem}' ) + ) ), + 'indb' => 4 + ) + ), array( //12 set new link using id (without badges) - 'p' => array( 'handle' => 'Berlin', 'linksite' => 'svwiki', 'linktitle' => 'Berlin' ), - 'e' => array( 'value' => array( 'svwiki' => array( 'title' => 'Berlin', 'badges' => array() ) ), 'indb' => 5 ) ), + 'p' => array( + 'handle' => 'Berlin', + 'linksite' => 'svwiki', + 'linktitle' => 'Berlin' + ), + 'e' => array( + 'value' => array( 'svwiki' => array( + 'title' => 'Berlin', + 'badges' => array() + ) ), + 'indb' => 5 + ) + ), array( //13 delete link by not providing neither title nor badges 'p' => array( 'handle' => 'Berlin', 'linksite' => 'svwiki' ), - 'e' => array( 'value' => array(), 'indb' => 4 ) ), + 'e' => array( 'value' => array(), 'indb' => 4 ) + ), ); } public function provideExceptionData() { return array( array( //0 badtoken - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'svwiki', 'linktitle' => 'testSetSiteLinkWithNoToken' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'notoken', 'message' => 'The token parameter must be set' ) ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'svwiki', + 'linktitle' => 'testSetSiteLinkWithNoToken' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'notoken', + 'message' => 'The token parameter must be set' + ) ) + ), array( //1 - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'svwiki', 'linktitle' => 'testSetSiteLinkWithBadToken', 'token' => '88888888888888888888888888888888+\\' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'badtoken', 'message' => 'Invalid token' ) ) ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'svwiki', + 'linktitle' => 'testSetSiteLinkWithBadToken', + 'token' => '88888888888888888888888888888888+\\' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'badtoken', + 'message' => 'Invalid token' + ) ) + ), array( //2 testSetSiteLinkWithNoId - 'p' => array( 'linksite' => 'enwiki', 'linktitle' => 'testSetSiteLinkWithNoId' ), + 'p' => array( + 'linksite' => 'enwiki', + 'linktitle' => 'testSetSiteLinkWithNoId' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), array( //3 testSetSiteLinkWithBadId - 'p' => array( 'id' => 123456789, 'linksite' => 'enwiki', 'linktitle' => 'testSetSiteLinkWithNoId' ), + 'p' => array( + 'id' => 123456789, + 'linksite' => 'enwiki', + 'linktitle' => 'testSetSiteLinkWithNoId' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), array( //4 testSetSiteLinkWithBadSite - 'p' => array( 'site' => 'dewiktionary', 'title' => 'Berlin', 'linksite' => 'enwiki', 'linktitle' => 'Berlin' ), + 'p' => array( + 'site' => 'dewiktionary', + 'title' => 'Berlin', + 'linksite' => 'enwiki', + 'linktitle' => 'Berlin' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), array( //5 testSetSiteLinkWithBadTitle - 'p' => array( 'site' => 'dewiki', 'title' => 'BadTitle_de', 'linksite' => 'enwiki', 'linktitle' => 'BadTitle_en' ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'BadTitle_de', + 'linksite' => 'enwiki', + 'linktitle' => 'BadTitle_en' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), array( //6 testSetSiteLinkWithBadTargetSite - 'p' => array( 'site' => 'dewiki', 'title' => 'Berlin', 'linksite' => 'enwiktionary', 'linktitle' => 'Berlin' ), + 'p' => array( + 'site' => 'dewiki', + 'title' => 'Berlin', + 'linksite' => 'enwiktionary', + 'linktitle' => 'Berlin' + ), 'e' => array( 'exception' => array( 'type' => 'UsageException' ) ) ), array( //7 badge item does not exist - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'linksite' => 'enwiki', 'linktitle' => 'Berlin', 'badges' => 'Q99999|{faItem}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-entity' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'linksite' => 'enwiki', + 'linktitle' => 'Berlin', + 'badges' => 'Q99999|{faItem}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'no-such-entity' + ) ) + ), array( //8 no sitelink - cannot change badges - 'p' => array( 'site' => 'enwiki', 'title' => 'Berlin', 'linksite' => 'svwiki', 'badges' => '{gaItem}|{faItem}' ), - 'e' => array( 'exception' => array( 'type' => 'UsageException', 'code' => 'no-such-sitelink' ) ) ), + 'p' => array( + 'site' => 'enwiki', + 'title' => 'Berlin', + 'linksite' => 'svwiki', + 'badges' => '{gaItem}|{faItem}' + ), + 'e' => array( 'exception' => array( + 'type' => 'UsageException', + 'code' => 'no-such-sitelink' + ) ) + ), ); } public function provideBadBadgeData() { return array( array( //0 bad badge id - array( 'site' => 'enwiki', 'title' => 'Berlin', 'linksite' => 'enwiki', 'linktitle' => 'Berlin', 'badges' => 'abc|{faItem}' ), + array( 'site' => 'enwiki', + 'title' => 'Berlin', + 'linksite' => 'enwiki', + 'linktitle' => 'Berlin', + 'badges' => 'abc|{faItem}' + ), ), array( //1 badge id is not an item id - array( 'site' => 'enwiki', 'title' => 'Berlin', 'linksite' => 'enwiki', 'linktitle' => 'Berlin', 'badges' => 'P2|{faItem}' ), + array( 'site' => 'enwiki', + 'title' => 'Berlin', + 'linksite' => 'enwiki', + 'linktitle' => 'Berlin', + 'badges' => 'P2|{faItem}' + ), ), array( //2 badge id is not specified - array( 'site' => 'enwiki', 'title' => 'Berlin', 'linksite' => 'enwiki', 'linktitle' => 'Berlin', 'badges' => '{faItem}|{otherItem}' ) + array( 'site' => 'enwiki', + 'title' => 'Berlin', + 'linksite' => 'enwiki', + 'linktitle' => 'Berlin', + 'badges' => '{faItem}|{otherItem}' + ) ) ); } diff --git a/repo/tests/phpunit/includes/rdf/ComplexValueRdfBuilderTest.php b/repo/tests/phpunit/includes/rdf/ComplexValueRdfBuilderTest.php index 54f9371..0ec2a87 100644 --- a/repo/tests/phpunit/includes/rdf/ComplexValueRdfBuilderTest.php +++ b/repo/tests/phpunit/includes/rdf/ComplexValueRdfBuilderTest.php @@ -141,12 +141,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P4> <http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> .', ), array( - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#GlobecoordinateValue> .', - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://wikiba.se/ontology-beta#geoGlobe> <https://www.wikidata.org/entity/Q2> .', - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://wikiba.se/ontology-beta#geoLatitude> "12.25"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://wikiba.se/ontology-beta#geoLongitude> "-45.5"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> <http://wikiba.se/ontology-beta#geoPrecision> "0.025"^^<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#GlobecoordinateValue> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://wikiba.se/ontology-beta#geoGlobe> ' + . '<https://www.wikidata.org/entity/Q2> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://wikiba.se/ontology-beta#geoLatitude> "12.25"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://wikiba.se/ontology-beta#geoLongitude> "-45.5"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/7901049a90a3b6a6cbbae50dc76c2da9> ' + . '<http://wikiba.se/ontology-beta#geoPrecision> "0.025"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', ), ), 'monolingualtext' => array( @@ -169,12 +181,23 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P6> <http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> .', ), array( - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#QuantityValue> .', - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://wikiba.se/ontology-beta#quantityAmount> "+0.00011"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://wikiba.se/ontology-beta#quantityLowerBound> "+0.00010"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://wikiba.se/ontology-beta#quantityUnit> "1" .', - '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> <http://wikiba.se/ontology-beta#quantityUpperBound> "+0.00013"^^<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#QuantityValue> .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://wikiba.se/ontology-beta#quantityAmount> "+0.00011"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://wikiba.se/ontology-beta#quantityLowerBound> "+0.00010"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://wikiba.se/ontology-beta#quantityUnit> "1" .', + '<http://acme.test/value/ea39bdf723a70acd2e22d07dd0db7721> ' + . '<http://wikiba.se/ontology-beta#quantityUpperBound> "+0.00013"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', ), ), 'quantity-unit' => array( @@ -189,12 +212,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P6> <http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> .', ), array( - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#QuantityValue> .', - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://wikiba.se/ontology-beta#quantityAmount> "-2.3"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://wikiba.se/ontology-beta#quantityLowerBound> "-2.3"^^<http://www.w3.org/2001/XMLSchema#decimal> .', - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://wikiba.se/ontology-beta#quantityUnit> "https://www.wikidata.org/entity/Q11573" .', - '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> <http://wikiba.se/ontology-beta#quantityUpperBound> "-2.3"^^<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#QuantityValue> .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://wikiba.se/ontology-beta#quantityAmount> "-2.3"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://wikiba.se/ontology-beta#quantityLowerBound> "-2.3"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://wikiba.se/ontology-beta#quantityUnit> ' + . '"https://www.wikidata.org/entity/Q11573" .', + '<http://acme.test/value/9744b3301e3a9b3b5a31f6c6ba46dae0> ' + . '<http://wikiba.se/ontology-beta#quantityUpperBound> "-2.3"^^' + . '<http://www.w3.org/2001/XMLSchema#decimal> .', ), ), 'string' => array( @@ -213,12 +248,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P8> <http://acme.test/value/7a453935e4288ff180c20a7304bab948> .' ), array( - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> .', - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://wikiba.se/ontology-beta#timeCalendarModel> <http://www.wikidata.org/entity/Q1985727> .', - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://wikiba.se/ontology-beta#timePrecision> "11"^^<http://www.w3.org/2001/XMLSchema#integer> .', - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://wikiba.se/ontology-beta#timeValue> "2015-03-03T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .', - '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> <http://wikiba.se/ontology-beta#timeTimezone> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#TimeValue> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://wikiba.se/ontology-beta#timeCalendarModel> ' + . '<http://www.wikidata.org/entity/Q1985727> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://wikiba.se/ontology-beta#timePrecision> "11"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://wikiba.se/ontology-beta#timeValue> "2015-03-03T00:00:00Z"^^' + . '<http://www.w3.org/2001/XMLSchema#dateTime> .', + '<http://acme.test/value/7a453935e4288ff180c20a7304bab948> ' + . '<http://wikiba.se/ontology-beta#timeTimezone> "0"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', ), ), 'time-year' => array( // NOTE: may changed to use xsd:gYear @@ -229,12 +276,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P8> <http://acme.test/value/418aedfba643e02a5ba758952f8f7765> .', ), array( - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> .', - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://wikiba.se/ontology-beta#timeCalendarModel> <http://www.wikidata.org/entity/Q1985727> .', - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://wikiba.se/ontology-beta#timePrecision> "9"^^<http://www.w3.org/2001/XMLSchema#integer> .', - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://wikiba.se/ontology-beta#timeValue> "2015-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .', - '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> <http://wikiba.se/ontology-beta#timeTimezone> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#TimeValue> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://wikiba.se/ontology-beta#timeCalendarModel> ' + . '<http://www.wikidata.org/entity/Q1985727> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://wikiba.se/ontology-beta#timePrecision> "9"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://wikiba.se/ontology-beta#timeValue> "2015-01-01T00:00:00Z"^^' + . '<http://www.w3.org/2001/XMLSchema#dateTime> .', + '<http://acme.test/value/418aedfba643e02a5ba758952f8f7765> ' + . '<http://wikiba.se/ontology-beta#timeTimezone> "0"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', ), ), 'time-margin' => array( @@ -245,12 +304,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P8> <http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> .', ), array( - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> .', - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://wikiba.se/ontology-beta#timeCalendarModel> <http://www.wikidata.org/entity/Q1985727> .', - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://wikiba.se/ontology-beta#timePrecision> "11"^^<http://www.w3.org/2001/XMLSchema#integer> .', - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://wikiba.se/ontology-beta#timeValue> "2015-03-03T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .', - '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> <http://wikiba.se/ontology-beta#timeTimezone> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#TimeValue> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://wikiba.se/ontology-beta#timeCalendarModel> ' + . '<http://www.wikidata.org/entity/Q1985727> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://wikiba.se/ontology-beta#timePrecision> "11"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://wikiba.se/ontology-beta#timeValue> "2015-03-03T00:00:00Z"^^' + . '<http://www.w3.org/2001/XMLSchema#dateTime> .', + '<http://acme.test/value/8977346cbe7d0a6624ebd06fe27d749f> ' + . '<http://wikiba.se/ontology-beta#timeTimezone> "0"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', ), ), 'time-bce' => array( // NOTE: This assumes that internal data and the RDF data use the @@ -265,12 +336,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P8> <http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> .', ), array( - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> .', - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://wikiba.se/ontology-beta#timeCalendarModel> <http://www.wikidata.org/entity/Q1985727> .', - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://wikiba.se/ontology-beta#timePrecision> "11"^^<http://www.w3.org/2001/XMLSchema#integer> .', - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://wikiba.se/ontology-beta#timeValue> "-0044-03-15T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .', - '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> <http://wikiba.se/ontology-beta#timeTimezone> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#TimeValue> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://wikiba.se/ontology-beta#timeCalendarModel> ' + . '<http://www.wikidata.org/entity/Q1985727> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://wikiba.se/ontology-beta#timePrecision> "11"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://wikiba.se/ontology-beta#timeValue> "-0044-03-15T00:00:00Z"^^' + . '<http://www.w3.org/2001/XMLSchema#dateTime> .', + '<http://acme.test/value/ef167a47c30f27b0c70e210b27257d50> ' + . '<http://wikiba.se/ontology-beta#timeTimezone> "0"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', ), ), 'time-julian' => array( // NOTE: Currently, giving a calendar other than gregorian @@ -286,12 +369,24 @@ '<http://acme.test/Q11> <http://acme.test/prop/statement/value/P8> <http://acme.test/value/23a636870974bab8f1771b34aa994936> .', ), array( - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#Value> .', - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> .', - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://wikiba.se/ontology-beta#timeCalendarModel> <http://www.wikidata.org/entity/Q1985786> .', - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://wikiba.se/ontology-beta#timePrecision> "11"^^<http://www.w3.org/2001/XMLSchema#integer> .', - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://wikiba.se/ontology-beta#timeValue> "1492-10-21T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .', - '<http://acme.test/value/23a636870974bab8f1771b34aa994936> <http://wikiba.se/ontology-beta#timeTimezone> "0"^^<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#Value> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ' + . '<http://wikiba.se/ontology-beta#TimeValue> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://wikiba.se/ontology-beta#timeCalendarModel> ' + . '<http://www.wikidata.org/entity/Q1985786> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://wikiba.se/ontology-beta#timePrecision> "11"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://wikiba.se/ontology-beta#timeValue> "1492-10-21T00:00:00Z"^^' + . '<http://www.w3.org/2001/XMLSchema#dateTime> .', + '<http://acme.test/value/23a636870974bab8f1771b34aa994936> ' + . '<http://wikiba.se/ontology-beta#timeTimezone> "0"^^' + . '<http://www.w3.org/2001/XMLSchema#integer> .', ), ), 'url' => array( diff --git a/view/tests/phpunit/SiteLinksViewTest.php b/view/tests/phpunit/SiteLinksViewTest.php index ec3d788..e62d5fe 100644 --- a/view/tests/phpunit/SiteLinksViewTest.php +++ b/view/tests/phpunit/SiteLinksViewTest.php @@ -41,7 +41,12 @@ $this->assertInternalType( 'string', $value ); $this->assertTag( $expectedValue, $value, $value . ' did not match ' . var_export( $expectedValue, true ) ); - $this->assertContains( '<h2 class="wb-section-heading section-heading wikibase-sitelinks" dir="auto"><span id="sitelinks"', $value, 'Html should contain section heading' ); + $this->assertContains( + '<h2 class="wb-section-heading section-heading wikibase-sitelinks" dir="auto">' + . '<span id="sitelinks"', + $value, + 'Html should contain section heading' + ); } public function getHtmlProvider() { -- To view, visit https://gerrit.wikimedia.org/r/223016 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5f5a81b2db4f9f464ff9f34195bcefc870417f33 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Addshore <addshorew...@gmail.com> Gerrit-Reviewer: Bene <benestar.wikime...@gmail.com> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits