Go to the documentation of this file.
29 $this->assertContains(
'First', $work->getParserOutput()->getText() );
33 $this->assertContains(
'Second', $work->getParserOutput()->getText() );
44 $cache = MediaWikiServices::getInstance()->getParserCache();
47 $this->assertNotNull(
$out );
48 $this->assertNotFalse(
$out );
49 $this->assertContains(
'First',
$out->getText() );
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 );
80 $text = $work->getParserOutput()->getText();
81 $this->assertContains(
'YES!', $text );
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();
127 $rev = $page->getRevision()->getRevisionRecord();
135 $expected = strval( $callback(
$rev ) );
136 $output = $work->getParserOutput();
138 $this->assertContains( $expected,
$output->getText() );
146 $this->assertFalse( $work->execute() );
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() );
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
processing should stop and the error should be shown to the user * false
testDoWorkWithExplicitRevision()
newPageUpdater(User $user, RevisionSlotsUpdate $forUpdate=null)
Returns a PageUpdater for creating new revisions on this page (or creating the page).
testMagicWords( $wikitext, $callback)
provideMagicWords
Class representing a MediaWiki article and history.
PoolWorkArticleView Database.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
execute( $skipcache=false)
Get the result of the work (whatever it is), or the result of the error() function.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Content object for wiki text pages.
makeRevision(WikiPage $page, $text)
static newCanonical( $context=null, $userLang=null)
Creates a "canonical" ParserOptions object.
testDoWorkDeletedContent()
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
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
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 noclasses just before the function returns a value If you return true
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
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