Split some Language methods to LanguageNameUtils
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiQuerySiteinfoTest.php
1 <?php
2
3 use MediaWiki\MediaWikiServices;
4
5 /**
6 * @group API
7 * @group medium
8 * @group Database
9 *
10 * @covers ApiQuerySiteinfo
11 */
12 class ApiQuerySiteinfoTest extends ApiTestCase {
13 // We don't try to test every single thing for every category, just a sample
14
15 protected function doQuery( $siprop = null, $extraParams = [] ) {
16 $params = [ 'action' => 'query', 'meta' => 'siteinfo' ];
17 if ( $siprop !== null ) {
18 $params['siprop'] = $siprop;
19 }
20 $params = array_merge( $params, $extraParams );
21
22 $res = $this->doApiRequest( $params );
23
24 $this->assertArrayNotHasKey( 'warnings', $res[0] );
25 $this->assertCount( 1, $res[0]['query'] );
26
27 return $res[0]['query'][$siprop === null ? 'general' : $siprop];
28 }
29
30 public function testGeneral() {
31 $this->setMwGlobals( [
32 'wgAllowExternalImagesFrom' => '//localhost/',
33 ] );
34
35 $data = $this->doQuery();
36
37 $this->assertSame( Title::newMainPage()->getPrefixedText(), $data['mainpage'] );
38 $this->assertSame( PHP_VERSION, $data['phpversion'] );
39 $this->assertSame( [ '//localhost/' ], $data['externalimages'] );
40 }
41
42 public function testLinkPrefixCharset() {
43 $contLang = Language::factory( 'ar' );
44 $this->setContentLang( $contLang );
45 $this->assertTrue( $contLang->linkPrefixExtension(), 'Sanity check' );
46
47 $data = $this->doQuery();
48
49 $this->assertSame( $contLang->linkPrefixCharset(), $data['linkprefixcharset'] );
50 }
51
52 public function testVariants() {
53 $contLang = Language::factory( 'zh' );
54 $this->setContentLang( $contLang );
55 $this->assertTrue( $contLang->hasVariants(), 'Sanity check' );
56
57 $data = $this->doQuery();
58
59 $expected = array_map(
60 function ( $code ) use ( $contLang ) {
61 return [ 'code' => $code, 'name' => $contLang->getVariantname( $code ) ];
62 },
63 $contLang->getVariants()
64 );
65
66 $this->assertSame( $expected, $data['variants'] );
67 }
68
69 public function testReadOnly() {
70 $svc = MediaWikiServices::getInstance()->getReadOnlyMode();
71 $svc->setReason( 'Need more donations' );
72 try {
73 $data = $this->doQuery();
74 } finally {
75 $svc->setReason( false );
76 }
77
78 $this->assertTrue( $data['readonly'] );
79 $this->assertSame( 'Need more donations', $data['readonlyreason'] );
80 }
81
82 public function testNamespacesBasic() {
83 $this->assertSame(
84 array_keys( MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces() ),
85 array_keys( $this->doQuery( 'namespaces' ) )
86 );
87 }
88
89 public function testNamespacesExtraNS() {
90 $this->setMwGlobals( 'wgExtraNamespaces', [ '138' => 'Testing' ] );
91 $this->assertSame(
92 array_keys( MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces() ),
93 array_keys( $this->doQuery( 'namespaces' ) )
94 );
95 }
96
97 public function testNamespacesProtection() {
98 $this->setMwGlobals(
99 'wgNamespaceProtection',
100 [
101 '0' => '',
102 '2' => [ '' ],
103 '4' => 'editsemiprotected',
104 '8' => [
105 'editinterface',
106 'noratelimit'
107 ],
108 '14' => [
109 'move-categorypages',
110 ''
111 ]
112 ]
113 );
114 $data = $this->doQuery( 'namespaces' );
115 $this->assertArrayNotHasKey( 'namespaceprotection', $data['0'] );
116 $this->assertArrayNotHasKey( 'namespaceprotection', $data['2'] );
117 $this->assertSame( 'editsemiprotected', $data['4']['namespaceprotection'] );
118 $this->assertSame( 'editinterface|noratelimit', $data['8']['namespaceprotection'] );
119 $this->assertSame( 'move-categorypages', $data['14']['namespaceprotection'] );
120 }
121
122 public function testNamespaceAliases() {
123 global $wgNamespaceAliases;
124
125 $expected = array_merge(
126 $wgNamespaceAliases,
127 MediaWikiServices::getInstance()->getContentLanguage()->getNamespaceAliases()
128 );
129 $expected = array_map(
130 function ( $key, $val ) {
131 return [ 'id' => $val, 'alias' => strtr( $key, '_', ' ' ) ];
132 },
133 array_keys( $expected ),
134 $expected
135 );
136
137 // Test that we don't list duplicates
138 $this->mergeMwGlobalArrayValue( 'wgNamespaceAliases', [ 'Talk' => NS_TALK ] );
139
140 $this->assertSame( $expected, $this->doQuery( 'namespacealiases' ) );
141 }
142
143 public function testSpecialPageAliases() {
144 $this->assertCount(
145 count( MediaWikiServices::getInstance()->getSpecialPageFactory()->getNames() ),
146 $this->doQuery( 'specialpagealiases' )
147 );
148 }
149
150 public function testMagicWords() {
151 $this->assertCount(
152 count( MediaWikiServices::getInstance()->getContentLanguage()->getMagicWords() ),
153 $this->doQuery( 'magicwords' )
154 );
155 }
156
157 /**
158 * @dataProvider interwikiMapProvider
159 */
160 public function testInterwikiMap( $filter ) {
161 global $wgServer, $wgScriptPath;
162
163 $dbw = wfGetDB( DB_MASTER );
164 $dbw->insert(
165 'interwiki',
166 [
167 [
168 'iw_prefix' => 'self',
169 'iw_url' => "$wgServer$wgScriptPath/index.php?title=$1",
170 'iw_api' => "$wgServer$wgScriptPath/api.php",
171 'iw_wikiid' => 'somedbname',
172 'iw_local' => true,
173 'iw_trans' => true,
174 ],
175 [
176 'iw_prefix' => 'foreign',
177 'iw_url' => '//foreign.example/wiki/$1',
178 'iw_api' => '',
179 'iw_wikiid' => '',
180 'iw_local' => false,
181 'iw_trans' => false,
182 ],
183 ],
184 __METHOD__,
185 'IGNORE'
186 );
187 $this->tablesUsed[] = 'interwiki';
188
189 $this->setMwGlobals( [
190 'wgLocalInterwikis' => [ 'self' ],
191 'wgExtraInterlanguageLinkPrefixes' => [ 'self' ],
192 'wgExtraLanguageNames' => [ 'self' => 'Recursion' ],
193 ] );
194 $this->resetServices();
195
196 MessageCache::singleton()->enable();
197
198 $this->editPage( 'MediaWiki:Interlanguage-link-self', 'Self!' );
199 $this->editPage( 'MediaWiki:Interlanguage-link-sitename-self', 'Circular logic' );
200
201 $expected = [];
202
203 if ( $filter === null || $filter === '!local' ) {
204 $expected[] = [
205 'prefix' => 'foreign',
206 'url' => wfExpandUrl( '//foreign.example/wiki/$1', PROTO_CURRENT ),
207 'protorel' => true,
208 ];
209 }
210 if ( $filter === null || $filter === 'local' ) {
211 $expected[] = [
212 'prefix' => 'self',
213 'local' => true,
214 'trans' => true,
215 'language' => 'Recursion',
216 'localinterwiki' => true,
217 'extralanglink' => true,
218 'linktext' => 'Self!',
219 'sitename' => 'Circular logic',
220 'url' => "$wgServer$wgScriptPath/index.php?title=$1",
221 'protorel' => false,
222 'wikiid' => 'somedbname',
223 'api' => "$wgServer$wgScriptPath/api.php",
224 ];
225 }
226
227 $data = $this->doQuery( 'interwikimap',
228 $filter === null ? [] : [ 'sifilteriw' => $filter ] );
229
230 $this->assertSame( $expected, $data );
231 }
232
233 public function interwikiMapProvider() {
234 return [ [ 'local' ], [ '!local' ], [ null ] ];
235 }
236
237 /**
238 * @dataProvider dbReplLagProvider
239 */
240 public function testDbReplLagInfo( $showHostnames, $includeAll ) {
241 if ( !$showHostnames && $includeAll ) {
242 $this->setExpectedApiException( 'apierror-siteinfo-includealldenied' );
243 }
244
245 $mockLB = $this->createMock( LoadBalancer::class );
246 $mockLB->method( 'getMaxLag' )->willReturn( [ null, 7, 1 ] );
247 $mockLB->method( 'getLagTimes' )->willReturn( [ 5, 7 ] );
248 $mockLB->method( 'getServerName' )->will( $this->returnValueMap( [
249 [ 0, 'apple' ], [ 1, 'carrot' ]
250 ] ) );
251 $mockLB->method( 'getLocalDomainID' )->willReturn( 'testdomain' );
252 $mockLB->expects( $this->never() )->method( $this->anythingBut(
253 'getMaxLag', 'getLagTimes', 'getServerName', 'getLocalDomainID', '__destruct'
254 ) );
255 $this->setService( 'DBLoadBalancer', $mockLB );
256
257 $this->setMwGlobals( 'wgShowHostnames', $showHostnames );
258
259 $expected = [];
260 if ( $includeAll ) {
261 $expected[] = [ 'host' => $showHostnames ? 'apple' : '', 'lag' => 5 ];
262 }
263 $expected[] = [ 'host' => $showHostnames ? 'carrot' : '', 'lag' => 7 ];
264
265 $data = $this->doQuery( 'dbrepllag', $includeAll ? [ 'sishowalldb' => '' ] : [] );
266
267 $this->assertSame( $expected, $data );
268 }
269
270 public function dbReplLagProvider() {
271 return [
272 'no hostnames, no showalldb' => [ false, false ],
273 'no hostnames, showalldb' => [ false, true ],
274 'hostnames, no showalldb' => [ true, false ],
275 'hostnames, showalldb' => [ true, true ]
276 ];
277 }
278
279 public function testStatistics() {
280 $this->setTemporaryHook( 'APIQuerySiteInfoStatisticsInfo',
281 function ( &$data ) {
282 $data['addedstats'] = 42;
283 }
284 );
285
286 $expected = [
287 'pages' => intval( SiteStats::pages() ),
288 'articles' => intval( SiteStats::articles() ),
289 'edits' => intval( SiteStats::edits() ),
290 'images' => intval( SiteStats::images() ),
291 'users' => intval( SiteStats::users() ),
292 'activeusers' => intval( SiteStats::activeUsers() ),
293 'admins' => intval( SiteStats::numberingroup( 'sysop' ) ),
294 'jobs' => intval( SiteStats::jobs() ),
295 'addedstats' => 42,
296 ];
297
298 $this->assertSame( $expected, $this->doQuery( 'statistics' ) );
299 }
300
301 /**
302 * @dataProvider groupsProvider
303 */
304 public function testUserGroups( $numInGroup ) {
305 global $wgGroupPermissions, $wgAutopromote;
306
307 $this->setGroupPermissions( 'viscount', 'perambulate', 'yes' );
308 $this->setGroupPermissions( 'viscount', 'legislate', '0' );
309 $this->setMwGlobals( [
310 'wgAddGroups' => [ 'viscount' => true, 'bot' => [] ],
311 'wgRemoveGroups' => [ 'viscount' => [ 'sysop' ], 'bot' => [ '*', 'earl' ] ],
312 'wgGroupsAddToSelf' => [ 'bot' => [ 'bureaucrat', 'sysop' ] ],
313 'wgGroupsRemoveFromSelf' => [ 'bot' => [ 'bot' ] ],
314 ] );
315
316 $data = $this->doQuery( 'usergroups', $numInGroup ? [ 'sinumberingroup' => '' ] : [] );
317
318 $names = array_map(
319 function ( $val ) {
320 return $val['name'];
321 },
322 $data
323 );
324
325 $this->assertSame( array_keys( $wgGroupPermissions ), $names );
326
327 foreach ( $data as $val ) {
328 if ( !$numInGroup ) {
329 $expectedSize = null;
330 } elseif ( $val['name'] === 'user' ) {
331 $expectedSize = SiteStats::users();
332 } elseif ( $val['name'] === '*' || isset( $wgAutopromote[$val['name']] ) ) {
333 $expectedSize = null;
334 } else {
335 $expectedSize = SiteStats::numberingroup( $val['name'] );
336 }
337
338 if ( $expectedSize === null ) {
339 $this->assertArrayNotHasKey( 'number', $val );
340 } else {
341 $this->assertSame( $expectedSize, $val['number'] );
342 }
343
344 if ( $val['name'] === 'viscount' ) {
345 $viscountFound = true;
346 $this->assertSame( [ 'perambulate' ], $val['rights'] );
347 $this->assertSame( User::getAllGroups(), $val['add'] );
348 } elseif ( $val['name'] === 'bot' ) {
349 $this->assertArrayNotHasKey( 'add', $val );
350 $this->assertArrayNotHasKey( 'remove', $val );
351 $this->assertSame( [ 'bureaucrat', 'sysop' ], $val['add-self'] );
352 $this->assertSame( [ 'bot' ], $val['remove-self'] );
353 }
354 }
355 }
356
357 public function testFileExtensions() {
358 global $wgFileExtensions;
359
360 // Add duplicate
361 $this->setMwGlobals( 'wgFileExtensions', array_merge( $wgFileExtensions, [ 'png' ] ) );
362
363 $expected = array_map(
364 function ( $val ) {
365 return [ 'ext' => $val ];
366 },
367 array_unique( $wgFileExtensions )
368 );
369
370 $this->assertSame( $expected, $this->doQuery( 'fileextensions' ) );
371 }
372
373 public function groupsProvider() {
374 return [
375 'numingroup' => [ true ],
376 'nonumingroup' => [ false ],
377 ];
378 }
379
380 public function testInstalledLibraries() {
381 // @todo Test no installed.json? Moving installed.json to a different name temporarily
382 // seems a bit scary, but I don't see any other way to do it.
383 //
384 // @todo Install extensions/skins somehow so that we can test they're filtered out
385 global $IP;
386
387 $path = "$IP/vendor/composer/installed.json";
388 if ( !file_exists( $path ) ) {
389 $this->markTestSkipped( 'No installed libraries' );
390 }
391
392 $expected = ( new ComposerInstalled( $path ) )->getInstalledDependencies();
393
394 $expected = array_filter( $expected,
395 function ( $info ) {
396 return strpos( $info['type'], 'mediawiki-' ) !== 0;
397 }
398 );
399
400 $expected = array_map(
401 function ( $name, $info ) {
402 return [ 'name' => $name, 'version' => $info['version'] ];
403 },
404 array_keys( $expected ),
405 array_values( $expected )
406 );
407
408 $this->assertSame( $expected, $this->doQuery( 'libraries' ) );
409 }
410
411 public function testExtensions() {
412 $tmpdir = $this->getNewTempDirectory();
413 touch( "$tmpdir/ErsatzExtension.php" );
414 touch( "$tmpdir/LICENSE" );
415 touch( "$tmpdir/AUTHORS.txt" );
416
417 $val = [
418 'path' => "$tmpdir/ErsatzExtension.php",
419 'name' => 'Ersatz Extension',
420 'namemsg' => 'ersatz-extension-name',
421 'author' => 'John Smith',
422 'version' => '0.0.2',
423 'url' => 'https://www.example.com/software/ersatz-extension',
424 'description' => 'An extension that is not what it seems.',
425 'descriptionmsg' => 'ersatz-extension-desc',
426 'license-name' => 'PD',
427 ];
428
429 $this->setMwGlobals( 'wgExtensionCredits', [ 'api' => [
430 $val,
431 [
432 'author' => [ 'John Smith', 'John Smith Jr.', '...' ],
433 'descriptionmsg' => [ 'another-extension-desc', 'param' ] ],
434 ] ] );
435
436 $data = $this->doQuery( 'extensions' );
437
438 $this->assertCount( 2, $data );
439
440 $this->assertSame( 'api', $data[0]['type'] );
441
442 $sharedKeys = [ 'name', 'namemsg', 'description', 'descriptionmsg', 'author', 'url',
443 'version', 'license-name' ];
444 foreach ( $sharedKeys as $key ) {
445 $this->assertSame( $val[$key], $data[0][$key] );
446 }
447
448 // @todo Test git info
449
450 $this->assertSame(
451 Title::newFromText( 'Special:Version/License/Ersatz Extension' )->getLinkURL(),
452 $data[0]['license']
453 );
454
455 $this->assertSame(
456 Title::newFromText( 'Special:Version/Credits/Ersatz Extension' )->getLinkURL(),
457 $data[0]['credits']
458 );
459
460 $this->assertSame( 'another-extension-desc', $data[1]['descriptionmsg'] );
461 $this->assertSame( [ 'param' ], $data[1]['descriptionmsgparams'] );
462 $this->assertSame( 'John Smith, John Smith Jr., ...', $data[1]['author'] );
463 }
464
465 /**
466 * @dataProvider rightsInfoProvider
467 */
468 public function testRightsInfo( $page, $url, $text, $expectedUrl, $expectedText ) {
469 $this->setMwGlobals( [
470 'wgRightsPage' => $page,
471 'wgRightsUrl' => $url,
472 'wgRightsText' => $text,
473 ] );
474
475 $this->assertSame(
476 [ 'url' => $expectedUrl, 'text' => $expectedText ],
477 $this->doQuery( 'rightsinfo' )
478 );
479 }
480
481 public function rightsInfoProvider() {
482 $textUrl = wfExpandUrl( Title::newFromText( 'License' ), PROTO_CURRENT );
483 $url = 'http://license.example/';
484
485 return [
486 'No rights info' => [ null, null, null, '', '' ],
487 'Only page' => [ 'License', null, null, $textUrl, 'License' ],
488 'Only URL' => [ null, $url, null, $url, '' ],
489 'Only text' => [ null, null, '!!!', '', '!!!' ],
490 // URL is ignored if page is specified
491 'Page and URL' => [ 'License', $url, null, $textUrl, 'License' ],
492 'URL and text' => [ null, $url, '!!!', $url, '!!!' ],
493 'Page and text' => [ 'License', null, '!!!', $textUrl, '!!!' ],
494 'Page and URL and text' => [ 'License', $url, '!!!', $textUrl, '!!!' ],
495 'Pagename "0"' => [ '0', null, null,
496 wfExpandUrl( Title::newFromText( '0' ), PROTO_CURRENT ), '0' ],
497 'URL "0"' => [ null, '0', null, '0', '' ],
498 'Text "0"' => [ null, null, '0', '', '0' ],
499 ];
500 }
501
502 public function testRestrictions() {
503 global $wgRestrictionTypes, $wgRestrictionLevels, $wgCascadingRestrictionLevels,
504 $wgSemiprotectedRestrictionLevels;
505
506 $this->assertSame( [
507 'types' => $wgRestrictionTypes,
508 'levels' => $wgRestrictionLevels,
509 'cascadinglevels' => $wgCascadingRestrictionLevels,
510 'semiprotectedlevels' => $wgSemiprotectedRestrictionLevels,
511 ], $this->doQuery( 'restrictions' ) );
512 }
513
514 /**
515 * @dataProvider languagesProvider
516 */
517 public function testLanguages( $langCode ) {
518 $expected = Language::fetchLanguageNames( (string)$langCode );
519
520 $expected = array_map(
521 function ( $code, $name ) {
522 return [
523 'code' => $code,
524 'bcp47' => LanguageCode::bcp47( $code ),
525 'name' => $name
526 ];
527 },
528 array_keys( $expected ),
529 array_values( $expected )
530 );
531
532 $data = $this->doQuery( 'languages',
533 $langCode !== null ? [ 'siinlanguagecode' => $langCode ] : [] );
534
535 $this->assertSame( $expected, $data );
536 }
537
538 public function languagesProvider() {
539 return [ [ null ], [ 'fr' ] ];
540 }
541
542 public function testLanguageVariants() {
543 $expectedKeys = array_filter( LanguageConverter::$languagesWithVariants,
544 function ( $langCode ) {
545 return !Language::factory( $langCode )->getConverter() instanceof FakeConverter;
546 }
547 );
548 sort( $expectedKeys );
549
550 $this->assertSame( $expectedKeys, array_keys( $this->doQuery( 'languagevariants' ) ) );
551 }
552
553 public function testLanguageVariantsDisabled() {
554 $this->setMwGlobals( 'wgDisableLangConversion', true );
555
556 $this->assertSame( [], $this->doQuery( 'languagevariants' ) );
557 }
558
559 /**
560 * @todo Test a skin with a description that's known to be different in a different language.
561 * Vector will do, but it's not installed by default.
562 *
563 * @todo Test that an invalid language code doesn't actually try reading any messages
564 *
565 * @dataProvider skinsProvider
566 */
567 public function testSkins( $code ) {
568 $data = $this->doQuery( 'skins', $code !== null ? [ 'siinlanguagecode' => $code ] : [] );
569
570 $expectedAllowed = Skin::getAllowedSkins();
571 $expectedDefault = Skin::normalizeKey( 'default' );
572
573 $i = 0;
574 foreach ( Skin::getSkinNames() as $name => $displayName ) {
575 $this->assertSame( $name, $data[$i]['code'] );
576
577 $msg = wfMessage( "skinname-$name" );
578 if ( $code && Language::isValidCode( $code ) ) {
579 $msg->inLanguage( $code );
580 } else {
581 $msg->inContentLanguage();
582 }
583 if ( $msg->exists() ) {
584 $displayName = $msg->text();
585 }
586 $this->assertSame( $displayName, $data[$i]['name'] );
587
588 if ( !isset( $expectedAllowed[$name] ) ) {
589 $this->assertTrue( $data[$i]['unusable'], "$name must be unusable" );
590 }
591 if ( $name === $expectedDefault ) {
592 $this->assertTrue( $data[$i]['default'], "$expectedDefault must be default" );
593 }
594 $i++;
595 }
596 }
597
598 public function skinsProvider() {
599 return [
600 'No language specified' => [ null ],
601 'Czech' => [ 'cs' ],
602 'Invalid language' => [ '/invalid/' ],
603 ];
604 }
605
606 public function testExtensionTags() {
607 $expected = array_map(
608 function ( $tag ) {
609 return "<$tag>";
610 },
611 MediaWikiServices::getInstance()->getParser()->getTags()
612 );
613
614 $this->assertSame( $expected, $this->doQuery( 'extensiontags' ) );
615 }
616
617 public function testFunctionHooks() {
618 $this->assertSame( MediaWikiServices::getInstance()->getParser()->getFunctionHooks(),
619 $this->doQuery( 'functionhooks' ) );
620 }
621
622 public function testVariables() {
623 $this->assertSame(
624 MediaWikiServices::getInstance()->getMagicWordFactory()->getVariableIDs(),
625 $this->doQuery( 'variables' )
626 );
627 }
628
629 public function testProtocols() {
630 global $wgUrlProtocols;
631
632 $this->assertSame( $wgUrlProtocols, $this->doQuery( 'protocols' ) );
633 }
634
635 public function testDefaultOptions() {
636 $this->assertSame( User::getDefaultOptions(), $this->doQuery( 'defaultoptions' ) );
637 }
638
639 public function testUploadDialog() {
640 global $wgUploadDialog;
641
642 $this->assertSame( $wgUploadDialog, $this->doQuery( 'uploaddialog' ) );
643 }
644
645 public function testGetHooks() {
646 global $wgHooks;
647
648 // Make sure there's something to report on
649 $this->setTemporaryHook( 'somehook',
650 function () {
651 return;
652 }
653 );
654
655 $expectedNames = $wgHooks;
656 ksort( $expectedNames );
657
658 $actualNames = array_map(
659 function ( $val ) {
660 return $val['name'];
661 },
662 $this->doQuery( 'showhooks' )
663 );
664
665 $this->assertSame( array_keys( $expectedNames ), $actualNames );
666 }
667
668 public function testContinuation() {
669 // Use $wgUrlProtocols to forge the size of the API query
670 global $wgAPIMaxResultSize, $wgUrlProtocols;
671
672 $protocol = 'foo://';
673
674 $this->setMwGlobals( 'wgUrlProtocols', [ $protocol ] );
675 $this->setMwGlobals( 'wgAPIMaxResultSize', strlen( $protocol ) );
676
677 $res = $this->doApiRequest( [
678 'action' => 'query',
679 'meta' => 'siteinfo',
680 'siprop' => 'protocols|languages',
681 ] );
682
683 $this->assertSame(
684 wfMessage( 'apiwarn-truncatedresult', Message::numParam( $wgAPIMaxResultSize ) )
685 ->text(),
686 $res[0]['warnings']['result']['warnings']
687 );
688
689 $this->assertSame( $wgUrlProtocols, $res[0]['query']['protocols'] );
690 $this->assertArrayNotHasKey( 'languages', $res[0] );
691 $this->assertTrue( $res[0]['batchcomplete'], 'batchcomplete should be true' );
692 $this->assertSame( [ 'siprop' => 'languages', 'continue' => '-||' ], $res[0]['continue'] );
693 }
694 }