33 $wgHooks[
'InterwikiLoadPrefix'][] =
function ( $prefix, &$data ) {
34 if ( $prefix !==
'interwikiprefix' ) {
39 'iw_prefix' =>
'interwikiprefix',
40 'iw_url' =>
'//test.wikipedia.org/wiki/$1',
50 $page = WikiPage::factory( Title::newFromText(
'ScribuntoTestPage' ) );
53 '{{int:mainpage}}<includeonly>...</includeonly><noinclude>...</noinclude>'
57 $testPageId = $page->getId();
60 $page = WikiPage::factory( Title::newFromText(
'ScribuntoTestRedirect' ) );
65 $page = WikiPage::factory( Title::newFromText(
'ScribuntoTestNonRedirect' ) );
73 $title = Title::newFromText(
'Main Page' );
74 $title->mRestrictionsLoaded =
true;
75 $title->mRestrictions = [
'edit' => [],
'move' => [] ];
76 $title->mCascadeSources = [
77 Title::makeTitle(
NS_MAIN,
"Lockbox" ),
78 Title::makeTitle(
NS_MAIN,
"Lockbox2" ),
80 $title->mCascadingRestrictions = [
'edit' => [
'sysop' ] ];
81 $title = Title::newFromText(
'Module:TestFramework' );
82 $title->mRestrictionsLoaded =
true;
84 'edit' => [
'sysop',
'bogus' ],
85 'move' => [
'sysop',
'bogus' ],
87 $title->mCascadeSources = [];
88 $title->mCascadingRestrictions = [];
89 $title = Title::newFromText(
'interwikiprefix:Module:TestFramework' );
90 $title->mRestrictionsLoaded =
true;
91 $title->mRestrictions = [];
92 $title->mCascadeSources = [];
93 $title->mCascadingRestrictions = [];
94 $title = Title::newFromText(
'Talk:Has/A/Subpage' );
95 $title->mRestrictionsLoaded =
true;
96 $title->mRestrictions = [
'create' => [
'sysop' ] ];
97 $title->mCascadeSources = [];
98 $title->mCascadingRestrictions = [];
99 $title = Title::newFromText(
'Not/A/Subpage' );
100 $title->mRestrictionsLoaded =
true;
101 $title->mRestrictions = [
'edit' => [
'autoconfirmed' ],
'move' => [
'sysop' ] ];
102 $title->mCascadeSources = [];
103 $title->mCascadingRestrictions = [];
104 $title = Title::newFromText(
'Module talk:Test Framework' );
105 $title->mRestrictionsLoaded =
true;
106 $title->mRestrictions = [
'edit' => [],
'move' => [
'sysop' ] ];
107 $title->mCascadeSources = [];
108 $title->mCascadingRestrictions = [];
111 $this->
getEngine()->getParser()->getOptions()->setExpensiveParserFunctionLimit( 10 );
114 $interpreter = $this->
getEngine()->getInterpreter();
115 $interpreter->callFunction(
116 $interpreter->loadString(
"mw.title.testPageId = $testPageId",
'fortest' )
119 $this->setMwGlobals( [
120 'wgServer' =>
'//wiki.local',
121 'wgCanonicalServer' =>
'http://wiki.local',
122 'wgUsePathInfo' =>
true,
123 'wgActionPaths' => [],
124 'wgScript' =>
'/w/index.php',
125 'wgScriptPath' =>
'/w',
126 'wgArticlePath' =>
'/wiki/$1',
144 $interpreter =
$engine->getInterpreter();
147 $links =
$engine->getParser()->getOutput()->getLinks();
148 $this->assertFalse( isset( $links[
NS_PROJECT][
'Referenced_from_Lua'] ) );
150 $interpreter->callFunction( $interpreter->loadString(
151 'local _ = mw.title.new( "Project:Referenced from Lua" ).id',
'reference title'
154 $links =
$engine->getParser()->getOutput()->getLinks();
155 $this->assertArrayHasKey(
NS_PROJECT, $links );
156 $this->assertArrayHasKey(
'Referenced_from_Lua', $links[
NS_PROJECT] );
159 $templates =
$engine->getParser()->getOutput()->getTemplates();
160 $this->assertFalse( isset( $links[
NS_PROJECT][
'Loaded_from_Lua'] ) );
162 $interpreter->callFunction( $interpreter->loadString(
163 'mw.title.new( "Project:Loaded from Lua" ):getContent()',
'load title'
166 $templates =
$engine->getParser()->getOutput()->getTemplates();
167 $this->assertArrayHasKey(
NS_PROJECT, $templates );
168 $this->assertArrayHasKey(
'Loaded_from_Lua', $templates[
NS_PROJECT] );