Index: trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php |
— | — | @@ -84,8 +84,7 @@ |
85 | 85 | $dbw = $this->db; |
86 | 86 | $title = Title::newFromText( $pageName ); |
87 | 87 | |
88 | | - $userId = 0; |
89 | | - $userText = 'WikiSysop'; |
| 88 | + $user = User::newFromName( 'WikiSysop' ); |
90 | 89 | $comment = 'Search Test'; |
91 | 90 | |
92 | 91 | // avoid memory leak...? |
— | — | @@ -93,41 +92,8 @@ |
94 | 93 | $linkCache->clear(); |
95 | 94 | |
96 | 95 | $article = new Article( $title ); |
97 | | - $pageId = $article->getId(); |
98 | | - $created = false; |
99 | | - if ( $pageId == 0 ) { |
100 | | - # must create the page... |
101 | | - $pageId = $article->insertOn( $dbw ); |
102 | | - $created = true; |
103 | | - } |
| 96 | + $article->doEdit( $text, $comment, 0, false, $user ); |
104 | 97 | |
105 | | - # FIXME: Use original rev_id optionally (better for backups) |
106 | | - # Insert the row |
107 | | - $revision = new Revision( array( |
108 | | - 'page' => $pageId, |
109 | | - 'text' => $text, |
110 | | - 'comment' => $comment, |
111 | | - 'user' => $userId, |
112 | | - 'user_text' => $userText, |
113 | | - 'timestamp' => 0, |
114 | | - 'minor_edit' => false, |
115 | | - ) ); |
116 | | - $revId = $revision->insertOn( $dbw ); |
117 | | - $changed = $article->updateIfNewerOn( $dbw, $revision ); |
118 | | - |
119 | | - $GLOBALS['wgTitle'] = $title; |
120 | | - if ( $created ) { |
121 | | - Article::onArticleCreate( $title ); |
122 | | - $article->createUpdates( $revision ); |
123 | | - } elseif ( $changed ) { |
124 | | - Article::onArticleEdit( $title ); |
125 | | - $article->editUpdates( |
126 | | - $text, $comment, false, 0, $revId ); |
127 | | - } |
128 | | - |
129 | | - $su = new SearchUpdate( $article->getId(), $pageName, $text ); |
130 | | - $su->doUpdate(); |
131 | | - |
132 | 98 | $this->pageList[] = array( $title, $article->getId() ); |
133 | 99 | |
134 | 100 | return true; |