jenkins-bot has submitted this change and it was merged.
Change subject: Add test to EditEntityTest for the fix in Gerrit 135489
......................................................................
Add test to EditEntityTest for the fix in Gerrit 135489
See Ib0fd773dacddc782a93f53838c1189e41d16e748.
Change-Id: Ieafb629604f4680c23f9227b975f73b6dba8476a
---
M repo/tests/phpunit/includes/EditEntityTest.php
1 file changed, 30 insertions(+), 3 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
WikidataJenkins: Verified
jenkins-bot: Verified
diff --git a/repo/tests/phpunit/includes/EditEntityTest.php
b/repo/tests/phpunit/includes/EditEntityTest.php
index 8c6b39c..657b808 100644
--- a/repo/tests/phpunit/includes/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/EditEntityTest.php
@@ -2,6 +2,9 @@
namespace Wikibase\Test;
+use FauxRequest;
+use HashBagOStuff;
+use RequestContext;
use Status;
use Title;
use User;
@@ -121,8 +124,8 @@
* @return EditEntity
*/
protected function makeEditEntity( MockRepository $repo, Entity
$entity, User $user = null, $baseRevId = false, $permissions = null ) {
- $context = new \RequestContext();
- $context->setRequest( new \FauxRequest() );
+ $context = new RequestContext();
+ $context->setRequest( new FauxRequest() );
if ( !$user ) {
$user = User::newFromName( 'EditEntityTestUser' );
@@ -364,6 +367,30 @@
"If and only if there was an error, an error page
should be shown.\n$statusMessage" );
}
+ public function testErrorPage_DoesNotDoubleEscapeHtmlCharacters() {
+ $repo = $this->makeMockRepo();
+ $permissions = array();
+ $context = new RequestContext();
+ // Can not reuse makeEditEntity because we need the access the
context
+ $editEntity = new EditEntity(
+ $this->newTitleLookupMock(),
+ $repo,
+ $repo,
+ $this->newEntityPermissionCheckerMock( $permissions ),
+ Item::newEmpty(),
+ self::getUser( 'EditEntityTestUser' ),
+ false,
+ $context
+ );
+
+ $editEntity->checkEditPermissions();
+ $editEntity->showErrorPage();
+ $html = $context->getOutput()->getHTML();
+
+ $this->assertContains( '<li>', $html, 'Unescaped HTML' );
+ $this->assertNotContains( '&lt;', $html, 'No double
escaping' );
+ }
+
public function dataCheckEditPermissions() {
return array(
array( #0: edit allowed for new item
@@ -560,7 +587,7 @@
// make sure we have a fresh, working cache
$this->setMwGlobals(
'wgMemc',
- new \HashBagOStuff()
+ new HashBagOStuff()
);
$user = self::getUser( "UserForTestAttemptSaveRateLimit" );
--
To view, visit https://gerrit.wikimedia.org/r/135752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ieafb629604f4680c23f9227b975f73b6dba8476a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits