Merge "eslintrc: Disallow calling String/Array/Object methods introduced in ES6 or...
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQueryWatchlistIntegrationTest.php
index 5f59d6f..41ecd52 100644 (file)
@@ -2,6 +2,7 @@
 
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
+use MediaWiki\Revision\SlotRecord;
 
 /**
  * @group medium
@@ -89,17 +90,14 @@ class ApiQueryWatchlistIntegrationTest extends ApiTestCase {
                User $patrollingUser
        ) {
                $title = Title::newFromLinkTarget( $target );
+               $summary = CommentStoreComment::newUnsavedComment( trim( $summary ) );
                $page = WikiPage::factory( $title );
-               $status = $page->doEditContent(
-                       ContentHandler::makeContent( $content, $title ),
-                       $summary,
-                       0,
-                       false,
-                       $user
-               );
-               /** @var Revision $rev */
-               $rev = $status->value['revision'];
-               $rc = $rev->getRecentChange();
+
+               $updater = $page->newPageUpdater( $user );
+               $updater->setContent( SlotRecord::MAIN, ContentHandler::makeContent( $content, $title ) );
+               $rev = $updater->saveRevision( $summary );
+
+               $rc = MediaWikiServices::getInstance()->getRevisionStore()->getRecentChange( $rev );
                $rc->doMarkPatrolled( $patrollingUser, false, [] );
        }