From: Alexandre Emsenhuber Date: Fri, 13 May 2011 09:28:09 +0000 (+0000) Subject: Use Article::doEdit(), much, much easier X-Git-Tag: 1.31.0-rc.0~30262 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=0cf63ddea4972149e98e2dd62b7d806d08536a85;p=lhc%2Fweb%2Fwiklou.git Use Article::doEdit(), much, much easier --- diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php index f1b67dd8ba..86ef3a9c9b 100644 --- a/tests/phpunit/includes/search/SearchEngineTest.php +++ b/tests/phpunit/includes/search/SearchEngineTest.php @@ -84,8 +84,7 @@ class SearchEngineTest extends MediaWikiTestCase { $dbw = $this->db; $title = Title::newFromText( $pageName ); - $userId = 0; - $userText = 'WikiSysop'; + $user = User::newFromName( 'WikiSysop' ); $comment = 'Search Test'; // avoid memory leak...? @@ -93,40 +92,7 @@ class SearchEngineTest extends MediaWikiTestCase { $linkCache->clear(); $article = new Article( $title ); - $pageId = $article->getId(); - $created = false; - if ( $pageId == 0 ) { - # must create the page... - $pageId = $article->insertOn( $dbw ); - $created = true; - } - - # FIXME: Use original rev_id optionally (better for backups) - # Insert the row - $revision = new Revision( array( - 'page' => $pageId, - 'text' => $text, - 'comment' => $comment, - 'user' => $userId, - 'user_text' => $userText, - 'timestamp' => 0, - 'minor_edit' => false, - ) ); - $revId = $revision->insertOn( $dbw ); - $changed = $article->updateIfNewerOn( $dbw, $revision ); - - $GLOBALS['wgTitle'] = $title; - if ( $created ) { - Article::onArticleCreate( $title ); - $article->createUpdates( $revision ); - } elseif ( $changed ) { - Article::onArticleEdit( $title ); - $article->editUpdates( - $text, $comment, false, 0, $revId ); - } - - $su = new SearchUpdate( $article->getId(), $pageName, $text ); - $su->doUpdate(); + $article->doEdit( $text, $comment, 0, false, $user ); $this->pageList[] = array( $title, $article->getId() );