jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/345295 )
Change subject: Replace urlencode() with wfUrlencode()
......................................................................
Replace urlencode() with wfUrlencode()
These are the only usages of PHPs build-in "urlencode()". I think it's
better to avoid using it, in favor of the escaping the tested code
actually uses.
This patch obviously doesn't make a difference. It's just for consistency
across our code base, to avoid confusion.
Change-Id: I995619395837e48344de7d71a4a23196f9a91bc3
---
M lib/tests/phpunit/Formatters/HtmlExternalIdentifierFormatterTest.php
M lib/tests/phpunit/Formatters/WikitextExternalIdentifierFormatterTest.php
2 files changed, 7 insertions(+), 8 deletions(-)
Approvals:
Aleksey Bekh-Ivanov (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git
a/lib/tests/phpunit/Formatters/HtmlExternalIdentifierFormatterTest.php
b/lib/tests/phpunit/Formatters/HtmlExternalIdentifierFormatterTest.php
index 948065f..f156314 100644
--- a/lib/tests/phpunit/Formatters/HtmlExternalIdentifierFormatterTest.php
+++ b/lib/tests/phpunit/Formatters/HtmlExternalIdentifierFormatterTest.php
@@ -29,13 +29,12 @@
$formatterUrlExpander->expects( $this->any() )
->method( 'expandUrl' )
->will( $this->returnCallback( function(
PropertyValueSnak $snak ) {
- $id = $snak->getDataValue()->getValue();
-
if ( $snak->getPropertyId()->getSerialization()
=== 'P1' ) {
- return 'http://acme.test/stuff/' .
urlencode( $id );
- } else {
- return null;
+ $value =
$snak->getDataValue()->getValue();
+ return 'http://acme.test/stuff/' .
wfUrlencode( $value );
}
+
+ return null;
} ) );
return array(
diff --git
a/lib/tests/phpunit/Formatters/WikitextExternalIdentifierFormatterTest.php
b/lib/tests/phpunit/Formatters/WikitextExternalIdentifierFormatterTest.php
index 3bb191b..467df41 100644
--- a/lib/tests/phpunit/Formatters/WikitextExternalIdentifierFormatterTest.php
+++ b/lib/tests/phpunit/Formatters/WikitextExternalIdentifierFormatterTest.php
@@ -29,13 +29,13 @@
$formatterUrlExpander->expects( $this->any() )
->method( 'expandUrl' )
->will( $this->returnCallback( function(
PropertyValueSnak $snak ) {
- $id = $snak->getDataValue()->getValue();
+ $value = $snak->getDataValue()->getValue();
switch (
$snak->getPropertyId()->getSerialization() ) {
case 'P1':
- return
'http://acme.test/stuff/' . urlencode( $id );
+ return
'http://acme.test/stuff/' . wfUrlencode( $value );
case 'P2':
- return 'http://acme.test/[other
stuff]/<' . urlencode( $id ) . '>';
+ return 'http://acme.test/[other
stuff]/<' . wfUrlencode( $value ) . '>';
default:
return null;
}
--
To view, visit https://gerrit.wikimedia.org/r/345295
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I995619395837e48344de7d71a4a23196f9a91bc3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits