Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Add escaping test to EntityTermsViewTest
......................................................................

Add escaping test to EntityTermsViewTest

Test for the fix in Id394493.

I'm not sure if this is worth the trouble. Note that this is pretty
expensive because it creates a temporary page. Is there a better way
to mock a message?

Change-Id: Id5d96d898e86a5d45e52cc4892966a22dbd928c2
---
M view/tests/phpunit/EntityTermsViewTest.php
1 file changed, 13 insertions(+), 1 deletion(-)


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

diff --git a/view/tests/phpunit/EntityTermsViewTest.php 
b/view/tests/phpunit/EntityTermsViewTest.php
index 60537d8..03dc63f 100644
--- a/view/tests/phpunit/EntityTermsViewTest.php
+++ b/view/tests/phpunit/EntityTermsViewTest.php
@@ -4,6 +4,7 @@
 
 use Language;
 use MediaWikiLangTestCase;
+use MessageCache;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Term\Fingerprint;
 use Wikibase\View\EntityTermsView;
@@ -240,9 +241,20 @@
                $this->assertNotContains( '&', $html, 'no double escaping' 
);
        }
 
+       public function testGetEntityTermsForLanguageListView_isEscaped() {
+               MessageCache::singleton()->enable();
+               $this->setMwGlobals( 'wgLang', Language::factory( 'en' ) );
+               $this->insertPage( 
'MediaWiki:wikibase-entitytermsforlanguagelistview-language', "''RAW''" );
+
+               $view = $this->getEntityTermsView();
+               $html = $view->getEntityTermsForLanguageListView( new 
Fingerprint(), array() );
+
+               $this->assertContains( '''RAW''', $html );
+       }
+
        public function testGetEntityTermsForLanguageListView_isMarkedAsEmpty() 
{
                $view = $this->getEntityTermsView( 0, 1 );
-               $html = $view->getEntityTermsForLanguageListView( new 
Fingerprint(), array( 'en' ), null );
+               $html = $view->getEntityTermsForLanguageListView( new 
Fingerprint(), array( 'en' ) );
 
                $this->assertContains( 'wb-empty', $html );
                $this->assertContains( '(wikibase-label-empty)', $html );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5d96d898e86a5d45e52cc4892966a22dbd928c2
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

Reply via email to