Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Replace usages of Revision::getRawText
......................................................................

Replace usages of Revision::getRawText

Bug: T122754
Change-Id: Ic773243325f0d58594d8c9186e4824966d0f4e0f
---
M src/MediaWiki/EditInfoProvider.php
M src/MediaWiki/MediaWikiNsContentReader.php
M tests/phpunit/Unit/MediaWiki/EditInfoProviderTest.php
M tests/phpunit/Unit/MediaWiki/Hooks/NewRevisionFromEditCompleteTest.php
M tests/phpunit/Utils/Page/PageEditor.php
M tests/phpunit/Utils/PageCreator.php
M tests/phpunit/Utils/PageReader.php
7 files changed, 13 insertions(+), 15 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki 
refs/changes/93/263893/1

diff --git a/src/MediaWiki/EditInfoProvider.php 
b/src/MediaWiki/EditInfoProvider.php
index f834ca7..6fef109 100644
--- a/src/MediaWiki/EditInfoProvider.php
+++ b/src/MediaWiki/EditInfoProvider.php
@@ -90,7 +90,7 @@
 
        private function prepareTextForEdit() {
                return $this->wikiPage->prepareTextForEdit(
-                       $this->revision->getRawText(),
+                       $this->revision->getContent( Revision::RAW ),
                        null,
                        $this->user
                );
diff --git a/src/MediaWiki/MediaWikiNsContentReader.php 
b/src/MediaWiki/MediaWikiNsContentReader.php
index 6182ca7..c1a299e 100644
--- a/src/MediaWiki/MediaWikiNsContentReader.php
+++ b/src/MediaWiki/MediaWikiNsContentReader.php
@@ -68,7 +68,7 @@
                        return $revision->getContent()->getNativeData();
                }
 
-               return $revision->getRawText();
+               return $revision->getContent( Revision::RAW );
        }
 
 }
diff --git a/tests/phpunit/Unit/MediaWiki/EditInfoProviderTest.php 
b/tests/phpunit/Unit/MediaWiki/EditInfoProviderTest.php
index 1ac273d..697dc22 100644
--- a/tests/phpunit/Unit/MediaWiki/EditInfoProviderTest.php
+++ b/tests/phpunit/Unit/MediaWiki/EditInfoProviderTest.php
@@ -85,12 +85,11 @@
                        ->getMock();
 
                $revision->expects( $this->any() )
-                       ->method( 'getRawText' )
-                       ->will( $this->returnValue( 'Foo' ) );
-
-               $revision->expects( $this->any() )
                        ->method( 'getContent' )
-                       ->will( $this->returnValue( $this->newContent() ) );
+                       ->will( $this->returnValueMap( array(
+                               array( \Revision::RAW, null, 'Foo' ),
+                               array( \Revision::FOR_PUBLIC, null, 
$this->newContent() ),
+                       ) ) );
 
                #0 No parserOutput object
                $editInfo = (object)array();
diff --git 
a/tests/phpunit/Unit/MediaWiki/Hooks/NewRevisionFromEditCompleteTest.php 
b/tests/phpunit/Unit/MediaWiki/Hooks/NewRevisionFromEditCompleteTest.php
index 18b52c2..6ce8e30 100644
--- a/tests/phpunit/Unit/MediaWiki/Hooks/NewRevisionFromEditCompleteTest.php
+++ b/tests/phpunit/Unit/MediaWiki/Hooks/NewRevisionFromEditCompleteTest.php
@@ -102,12 +102,11 @@
                        ->getMock();
 
                $revision->expects( $this->any() )
-                       ->method( 'getRawText' )
-                       ->will( $this->returnValue( 'Foo' ) );
-
-               $revision->expects( $this->any() )
                        ->method( 'getContent' )
-                       ->will( $this->returnValue( $this->newContent() ) );
+                       ->will( $this->returnValueMap( array(
+                               array( \Revision::RAW, null, 'Foo' ),
+                               array( \Revision::FOR_PUBLIC, null, 
$this->newContent() ),
+                       ) ) );
 
                #0 No parserOutput object
                $editInfo = (object)array();
diff --git a/tests/phpunit/Utils/Page/PageEditor.php 
b/tests/phpunit/Utils/Page/PageEditor.php
index a5d9f0b..b249ea2 100644
--- a/tests/phpunit/Utils/Page/PageEditor.php
+++ b/tests/phpunit/Utils/Page/PageEditor.php
@@ -91,7 +91,7 @@
                }
 
                return $this->getPage()->prepareTextForEdit(
-                       $this->getPage()->getRevision()->getRawText(),
+                       $this->getPage()->getRevision()->getContent( 
Revision::RAW ),
                        null,
                        null
                );
diff --git a/tests/phpunit/Utils/PageCreator.php 
b/tests/phpunit/Utils/PageCreator.php
index 8a287bf..52a3466 100644
--- a/tests/phpunit/Utils/PageCreator.php
+++ b/tests/phpunit/Utils/PageCreator.php
@@ -109,7 +109,7 @@
                }
 
                return $this->getPage()->prepareTextForEdit(
-                       $this->getPage()->getRevision()->getRawText(),
+                       $this->getPage()->getRevision()->getContent( 
Revision::RAW ),
                        null,
                        null
                );
diff --git a/tests/phpunit/Utils/PageReader.php 
b/tests/phpunit/Utils/PageReader.php
index 63a0b80..d4985b7 100644
--- a/tests/phpunit/Utils/PageReader.php
+++ b/tests/phpunit/Utils/PageReader.php
@@ -80,7 +80,7 @@
                }
 
                return $this->page->prepareTextForEdit(
-                       $this->page->getRevision()->getRawText(),
+                       $this->page->getRevision()->getContent( Revsion::RAW ),
                        null,
                        null
                );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic773243325f0d58594d8c9186e4824966d0f4e0f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to