15 $updater = $page->newPageUpdater( $user );
18 return $updater->saveRevision( CommentStoreComment::newUnsavedComment(
'testing' ) );
22 $options = ParserOptions::newCanonical(
'canonical' );
29 $this->assertContains(
'First', $work->getParserOutput()->getText() );
33 $this->assertContains(
'Second', $work->getParserOutput()->getText() );
37 $options = ParserOptions::newCanonical(
'canonical' );
44 $cache = MediaWikiServices::getInstance()->getParserCache();
47 $this->assertNotNull(
$out );
48 $this->assertNotFalse(
$out );
49 $this->assertContains(
'First',
$out->getText() );
53 $options = ParserOptions::newCanonical(
'canonical' );
59 $fakeRev->setId(
$rev->getId() );
60 $fakeRev->setPageId( $page->getId() );
61 $fakeRev->setContent( SlotRecord::MAIN,
new WikitextContent(
'YES!' ) );
66 $text = $work->getParserOutput()->getText();
67 $this->assertContains(
'YES!', $text );
68 $this->assertNotContains(
'NOPE', $text );
72 $options = ParserOptions::newCanonical(
'canonical' );
80 $text = $work->getParserOutput()->getText();
81 $this->assertContains(
'YES!', $text );
85 $options = ParserOptions::newCanonical(
'canonical' );
91 $text = $work->getParserOutput()->getText();
92 $this->assertContains(
'YES!', $text );
97 'Test {{PAGEID}} Test',
99 return $rev->getPageId();
102 yield
'REVISIONID' => [
103 'Test {{REVISIONID}} Test',
105 return $rev->getId();
108 yield
'REVISIONUSER' => [
109 'Test {{REVISIONUSER}} Test',
111 return $rev->getUser()->getName();
114 yield
'REVISIONTIMESTAMP' => [
115 'Test {{REVISIONTIMESTAMP}} Test',
117 return $rev->getTimestamp();
125 $options = ParserOptions::newCanonical(
'canonical' );
127 $rev = $page->getRevision()->getRevisionRecord();
135 $expected = strval( $callback(
$rev ) );
136 $output = $work->getParserOutput();
138 $this->assertContains( $expected,
$output->getText() );
142 $options = ParserOptions::newCanonical(
'canonical' );
146 $this->assertFalse( $work->execute() );
150 $options = ParserOptions::newCanonical(
'canonical' );
152 $rev1 = $page->getRevision()->getRevisionRecord();
159 $fakeRev->setId( $rev1->getId() );
160 $fakeRev->setPageId( $page->getId() );
161 $fakeRev->setContent( SlotRecord::MAIN,
new WikitextContent(
'SECRET' ) );
162 $fakeRev->setVisibility( RevisionRecord::DELETED_TEXT );
165 $this->assertFalse( $work->execute() );
168 RevisionRecord::RAW );
169 $this->assertNotFalse( $work->execute() );
172 $fakeRev->setId( $rev2->getId() );
174 $this->assertNotFalse( $work->execute() );
PoolWorkArticleView Database.
makeRevision(WikiPage $page, $text)
testDoWorkDeletedContent()
testMagicWords( $wikitext, $callback)
provideMagicWords
testDoWorkWithExplicitRevision()
Class representing a MediaWiki article and history.
Content object for wiki text pages.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
$page->newPageUpdater($user) $updater