10 class ApiParseTest
extends ApiTestCase
{
12 protected static $pageId;
13 protected static $revIds = [];
15 public function addDBDataOnce() {
16 $title = Title
::newFromText( __CLASS__
);
18 $status = $this->editPage( __CLASS__
, 'Test for revdel' );
19 self
::$pageId = $status->value
['revision']->getPage();
20 self
::$revIds['revdel'] = $status->value
['revision']->getId();
22 $status = $this->editPage( __CLASS__
, 'Test for suppressed' );
23 self
::$revIds['suppressed'] = $status->value
['revision']->getId();
25 $status = $this->editPage( __CLASS__
, 'Test for oldid' );
26 self
::$revIds['oldid'] = $status->value
['revision']->getId();
28 $status = $this->editPage( __CLASS__
, 'Test for latest' );
29 self
::$revIds['latest'] = $status->value
['revision']->getId();
31 $this->revisionDelete( self
::$revIds['revdel'] );
32 $this->revisionDelete(
33 self
::$revIds['suppressed'],
34 [ Revision
::DELETED_TEXT
=> 1, Revision
::DELETED_RESTRICTED
=> 1 ]
37 Title
::clearCaches(); // Otherwise it has the wrong latest revision for some reason
41 * Assert that the given result of calling $this->doApiRequest() with
42 * action=parse resulted in $html, accounting for the boilerplate that the
43 * parser adds around the parsed page. Also asserts that warnings match
44 * the provided $warning.
46 * @param string $html Expected HTML
47 * @param array $res Returned from doApiRequest()
48 * @param string|null $warnings Exact value of expected warnings, null for
51 protected function assertParsedTo( $expected, array $res, $warnings = null ) {
52 $this->doAssertParsedTo( $expected, $res, $warnings, [ $this, 'assertSame' ] );
56 * Same as above, but asserts that the HTML matches a regexp instead of a
57 * literal string match.
59 * @param string $html Expected HTML
60 * @param array $res Returned from doApiRequest()
61 * @param string|null $warnings Exact value of expected warnings, null for
64 protected function assertParsedToRegExp( $expected, array $res, $warnings = null ) {
65 $this->doAssertParsedTo( $expected, $res, $warnings, [ $this, 'assertRegExp' ] );
68 private function doAssertParsedTo( $expected, array $res, $warnings, callable
$callback ) {
69 $html = $res[0]['parse']['text'];
71 $expectedStart = '<div class="mw-parser-output">';
72 $this->assertSame( $expectedStart, substr( $html, 0, strlen( $expectedStart ) ) );
74 $html = substr( $html, strlen( $expectedStart ) );
76 if ( $res[1]->getBool( 'disablelimitreport' ) ) {
77 $expectedEnd = "</div>";
78 $this->assertSame( $expectedEnd, substr( $html, -strlen( $expectedEnd ) ) );
80 $unexpectedEnd = '#<!-- \nNewPP limit report|' .
81 '<!--\nTransclusion expansion time report#s';
82 $this->assertNotRegExp( $unexpectedEnd, $html );
84 $html = substr( $html, 0, strlen( $html ) - strlen( $expectedEnd ) );
86 $expectedEnd = '#\n<!-- \nNewPP limit report\n(?>.+?\n-->)\n' .
87 '<!--\nTransclusion expansion time report \(%,ms,calls,template\)\n(?>.*?\n-->)\n' .
88 '(\n<!-- Saved in parser cache (?>.*?\n -->)\n)?</div>$#s';
89 $this->assertRegExp( $expectedEnd, $html );
91 $html = preg_replace( $expectedEnd, '', $html );
94 call_user_func( $callback, $expected, $html );
96 if ( $warnings === null ) {
97 $this->assertCount( 1, $res[0] );
99 $this->assertCount( 2, $res[0] );
100 $this->assertSame( [ 'warnings' => $warnings ], $res[0]['warnings']['parse'] );
105 * Set up an interwiki entry for testing.
107 protected function setupInterwiki() {
108 $dbw = wfGetDB( DB_MASTER
);
112 'iw_prefix' => 'madeuplanguage',
113 'iw_url' => "https://example.com/wiki/$1",
122 $this->setMwGlobals( 'wgExtraInterlanguageLinkPrefixes', [ 'madeuplanguage' ] );
123 $this->tablesUsed
[] = 'interwiki';
124 $this->overrideMwServices();
128 * Set up a skin for testing.
130 * @todo Should this code be in MediaWikiTestCase or something?
132 protected function setupSkin() {
133 $factory = new SkinFactory();
134 $factory->register( 'testing', 'Testing', function () {
135 $skin = $this->getMockBuilder( SkinFallback
::class )
136 ->setMethods( [ 'getDefaultModules', 'setupSkinUserCss' ] )
138 $skin->expects( $this->once() )->method( 'getDefaultModules' )
140 'styles' => [ 'core' => [ 'quux.styles' ] ],
141 'core' => [ 'foo', 'bar' ],
142 'content' => [ 'baz' ]
144 $skin->expects( $this->once() )->method( 'setupSkinUserCss' )
145 ->will( $this->returnCallback( function ( OutputPage
$out ) {
146 $out->addModuleStyles( 'foo.styles' );
150 $this->setService( 'SkinFactory', $factory );
153 public function testParseByName() {
154 $res = $this->doApiRequest( [
158 $this->assertParsedTo( "<p>Test for latest\n</p>", $res );
160 $res = $this->doApiRequest( [
163 'disablelimitreport' => 1,
165 $this->assertParsedTo( "<p>Test for latest\n</p>", $res );
168 public function testParseById() {
169 $res = $this->doApiRequest( [
171 'pageid' => self
::$pageId,
173 $this->assertParsedTo( "<p>Test for latest\n</p>", $res );
176 public function testParseByOldId() {
177 $res = $this->doApiRequest( [
179 'oldid' => self
::$revIds['oldid'],
181 $this->assertParsedTo( "<p>Test for oldid\n</p>", $res );
182 $this->assertArrayNotHasKey( 'textdeleted', $res[0]['parse'] );
183 $this->assertArrayNotHasKey( 'textsuppressed', $res[0]['parse'] );
186 public function testRevDel() {
187 $res = $this->doApiRequest( [
189 'oldid' => self
::$revIds['revdel'],
192 $this->assertParsedTo( "<p>Test for revdel\n</p>", $res );
193 $this->assertArrayHasKey( 'textdeleted', $res[0]['parse'] );
194 $this->assertArrayNotHasKey( 'textsuppressed', $res[0]['parse'] );
197 public function testRevDelNoPermission() {
198 $this->setExpectedException( ApiUsageException
::class,
199 "You don't have permission to view deleted revision text." );
201 $this->doApiRequest( [
203 'oldid' => self
::$revIds['revdel'],
204 ], null, null, static::getTestUser()->getUser() );
207 public function testSuppressed() {
208 $this->setGroupPermissions( 'sysop', 'viewsuppressed', true );
209 $this->overrideMwServices();
211 $res = $this->doApiRequest( [
213 'oldid' => self
::$revIds['suppressed']
216 $this->assertParsedTo( "<p>Test for suppressed\n</p>", $res );
217 $this->assertArrayHasKey( 'textsuppressed', $res[0]['parse'] );
218 $this->assertArrayHasKey( 'textdeleted', $res[0]['parse'] );
221 public function testNonexistentPage() {
223 $this->doApiRequest( [
225 'page' => 'DoesNotExist',
228 $this->fail( "API did not return an error when parsing a nonexistent page" );
229 } catch ( ApiUsageException
$ex ) {
230 $this->assertTrue( ApiTestCase
::apiExceptionHasCode( $ex, 'missingtitle' ),
231 "Parse request for nonexistent page must give 'missingtitle' error: "
232 . var_export( self
::getErrorFormatter()->arrayFromStatus( $ex->getStatusValue() ), true )
237 public function testTitleProvided() {
238 $res = $this->doApiRequest( [
240 'title' => 'Some interesting page',
241 'text' => '{{PAGENAME}} has attracted my attention',
244 $this->assertParsedTo( "<p>Some interesting page has attracted my attention\n</p>", $res );
247 public function testSection() {
248 $name = ucfirst( __FUNCTION__
);
250 $this->editPage( $name,
251 "Intro\n\n== Section 1 ==\n\nContent 1\n\n== Section 2 ==\n\nContent 2" );
253 $res = $this->doApiRequest( [
259 $this->assertParsedToRegExp( '!<h2>.*Section 1.*</h2>\n<p>Content 1\n</p>!', $res );
262 public function testInvalidSection() {
263 $this->setExpectedException( ApiUsageException
::class,
264 'The "section" parameter must be a valid section ID or "new".' );
266 $this->doApiRequest( [
268 'section' => 'T-new',
272 public function testSectionNoContent() {
273 $name = ucfirst( __FUNCTION__
);
275 $status = $this->editPage( $name,
276 "Intro\n\n== Section 1 ==\n\nContent 1\n\n== Section 2 ==\n\nContent 2" );
278 $this->setExpectedException( ApiUsageException
::class,
279 "Missing content for page ID {$status->value['revision']->getPage()}." );
281 $this->db
->delete( 'revision', [ 'rev_id' => $status->value
['revision']->getId() ] );
283 // Suppress warning in WikiPage::getContentModel
284 Wikimedia\
suppressWarnings();
286 $this->doApiRequest( [
292 Wikimedia\restoreWarnings
();
296 public function testNewSectionWithPage() {
297 $this->setExpectedException( ApiUsageException
::class,
298 '"section=new" cannot be combined with the "oldid", "pageid" or "page" ' .
299 'parameters. Please use "title" and "text".' );
301 $this->doApiRequest( [
308 public function testNonexistentOldId() {
309 $this->setExpectedException( ApiUsageException
::class,
310 'There is no revision with ID 2147483647.' );
312 $this->doApiRequest( [
314 'oldid' => pow( 2, 31 ) - 1,
318 public function testUnfollowedRedirect() {
319 $name = ucfirst( __FUNCTION__
);
321 $this->editPage( $name, "#REDIRECT [[$name 2]]" );
322 $this->editPage( "$name 2", "Some ''text''" );
324 $res = $this->doApiRequest( [
329 // Can't use assertParsedTo because the parser output is different for
331 $this->assertRegExp( "/Redirect to:.*$name 2/", $res[0]['parse']['text'] );
332 $this->assertArrayNotHasKey( 'warnings', $res[0] );
335 public function testFollowedRedirect() {
336 $name = ucfirst( __FUNCTION__
);
338 $this->editPage( $name, "#REDIRECT [[$name 2]]" );
339 $this->editPage( "$name 2", "Some ''text''" );
341 $res = $this->doApiRequest( [
347 $this->assertParsedTo( "<p>Some <i>text</i>\n</p>", $res );
350 public function testFollowedRedirectById() {
351 $name = ucfirst( __FUNCTION__
);
353 $id = $this->editPage( $name, "#REDIRECT [[$name 2]]" )->value
['revision']->getPage();
354 $this->editPage( "$name 2", "Some ''text''" );
356 $res = $this->doApiRequest( [
362 $this->assertParsedTo( "<p>Some <i>text</i>\n</p>", $res );
365 public function testInvalidTitle() {
366 $this->setExpectedException( ApiUsageException
::class, 'Bad title "|".' );
368 $this->doApiRequest( [
374 public function testTitleWithNonexistentRevId() {
375 $this->setExpectedException( ApiUsageException
::class,
376 'There is no revision with ID 2147483647.' );
378 $this->doApiRequest( [
380 'title' => __CLASS__
,
381 'revid' => pow( 2, 31 ) - 1,
385 public function testTitleWithNonMatchingRevId() {
386 $name = ucfirst( __FUNCTION__
);
388 $res = $this->doApiRequest( [
391 'revid' => self
::$revIds['latest'],
392 'text' => 'Some text',
395 $this->assertParsedTo( "<p>Some text\n</p>", $res,
396 'r' . self
::$revIds['latest'] . " is not a revision of $name." );
399 public function testRevId() {
400 $res = $this->doApiRequest( [
402 'revid' => self
::$revIds['latest'],
403 'text' => 'My revid is {{REVISIONID}}!',
406 $this->assertParsedTo( "<p>My revid is " . self
::$revIds['latest'] . "!\n</p>", $res );
409 public function testTitleNoText() {
410 $res = $this->doApiRequest( [
412 'title' => 'Special:AllPages',
415 $this->assertParsedTo( '', $res,
416 '"title" used without "text", and parsed page properties were requested. ' .
417 'Did you mean to use "page" instead of "title"?' );
420 public function testRevidNoText() {
421 $res = $this->doApiRequest( [
423 'revid' => self
::$revIds['latest'],
426 $this->assertParsedTo( '', $res,
427 '"revid" used without "text", and parsed page properties were requested. ' .
428 'Did you mean to use "oldid" instead of "revid"?' );
431 public function testTextNoContentModel() {
432 $res = $this->doApiRequest( [
434 'text' => "Some ''text''",
437 $this->assertParsedTo( "<p>Some <i>text</i>\n</p>", $res,
438 'No "title" or "contentmodel" was given, assuming wikitext.' );
441 public function testSerializationError() {
442 $this->setExpectedException( APIUsageException
::class,
443 'Content serialization failed: Could not unserialize content' );
445 $this->mergeMwGlobalArrayValue( 'wgContentHandlers',
446 [ 'testing-serialize-error' => 'DummySerializeErrorContentHandler' ] );
448 $this->doApiRequest( [
450 'text' => "Some ''text''",
451 'contentmodel' => 'testing-serialize-error',
455 public function testNewSection() {
456 $res = $this->doApiRequest( [
458 'title' => __CLASS__
,
460 'sectiontitle' => 'Title',
464 $this->assertParsedToRegExp( '!<h2>.*Title.*</h2>\n<p>Content\n</p>!', $res );
467 public function testExistingSection() {
468 $res = $this->doApiRequest( [
470 'title' => __CLASS__
,
472 'text' => "Intro\n\n== Section 1 ==\n\nContent\n\n== Section 2 ==\n\nMore content",
475 $this->assertParsedToRegExp( '!<h2>.*Section 1.*</h2>\n<p>Content\n</p>!', $res );
478 public function testNoPst() {
479 $name = ucfirst( __FUNCTION__
);
481 $this->editPage( "Template:$name", "Template ''text''" );
483 $res = $this->doApiRequest( [
485 'text' => "{{subst:$name}}",
486 'contentmodel' => 'wikitext',
489 $this->assertParsedTo( "<p>{{subst:$name}}\n</p>", $res );
492 public function testPst() {
493 $name = ucfirst( __FUNCTION__
);
495 $this->editPage( "Template:$name", "Template ''text''" );
497 $res = $this->doApiRequest( [
500 'text' => "{{subst:$name}}",
501 'contentmodel' => 'wikitext',
502 'prop' => 'text|wikitext',
505 $this->assertParsedTo( "<p>Template <i>text</i>\n</p>", $res );
506 $this->assertSame( "{{subst:$name}}", $res[0]['parse']['wikitext'] );
509 public function testOnlyPst() {
510 $name = ucfirst( __FUNCTION__
);
512 $this->editPage( "Template:$name", "Template ''text''" );
514 $res = $this->doApiRequest( [
517 'text' => "{{subst:$name}}",
518 'contentmodel' => 'wikitext',
519 'prop' => 'text|wikitext',
520 'summary' => 'Summary',
525 'text' => "Template ''text''",
526 'wikitext' => "{{subst:$name}}",
527 'parsedsummary' => 'Summary',
533 public function testHeadHtml() {
534 $res = $this->doApiRequest( [
537 'prop' => 'headhtml',
540 // Just do a rough sanity check
541 $this->assertRegExp( '#<!DOCTYPE.*<html.*<head.*</head>.*<body#s',
542 $res[0]['parse']['headhtml'] );
543 $this->assertArrayNotHasKey( 'warnings', $res[0] );
546 public function testCategoriesHtml() {
547 $name = ucfirst( __FUNCTION__
);
549 $this->editPage( $name, "[[Category:$name]]" );
551 $res = $this->doApiRequest( [
554 'prop' => 'categorieshtml',
557 $this->assertRegExp( "#Category.*Category:$name.*$name#",
558 $res[0]['parse']['categorieshtml'] );
559 $this->assertArrayNotHasKey( 'warnings', $res[0] );
562 public function testEffectiveLangLinks() {
564 $this->setTemporaryHook( 'LanguageLinks',
565 function () use ( &$hookRan ) {
570 $res = $this->doApiRequest( [
572 'title' => __CLASS__
,
573 'text' => '[[zh:' . __CLASS__
. ']]',
574 'effectivelanglinks' => '',
577 $this->assertTrue( $hookRan );
578 $this->assertSame( 'The parameter "effectivelanglinks" has been deprecated.',
579 $res[0]['warnings']['parse']['warnings'] );
583 * @param array $arr Extra params to add to API request
585 private function doTestLangLinks( array $arr = [] ) {
586 $res = $this->doApiRequest( array_merge( [
588 'title' => 'Omelette',
589 'text' => '[[madeuplanguage:Omelette]]',
590 'prop' => 'langlinks',
593 $langLinks = $res[0]['parse']['langlinks'];
595 $this->assertCount( 1, $langLinks );
596 $this->assertSame( 'madeuplanguage', $langLinks[0]['lang'] );
597 $this->assertSame( 'Omelette', $langLinks[0]['title'] );
598 $this->assertSame( 'https://example.com/wiki/Omelette', $langLinks[0]['url'] );
599 $this->assertArrayNotHasKey( 'warnings', $res[0] );
602 public function testLangLinks() {
603 $this->setupInterwiki();
604 $this->doTestLangLinks();
607 public function testLangLinksWithSkin() {
608 $this->setupInterwiki();
610 $this->doTestLangLinks( [ 'useskin' => 'testing' ] );
613 public function testHeadItems() {
614 $res = $this->doApiRequest( [
616 'title' => __CLASS__
,
618 'prop' => 'headitems',
621 $this->assertSame( [], $res[0]['parse']['headitems'] );
623 '"prop=headitems" is deprecated since MediaWiki 1.28. ' .
624 'Use "prop=headhtml" when creating new HTML documents, ' .
625 'or "prop=modules|jsconfigvars" when updating a document client-side.',
626 $res[0]['warnings']['parse']['warnings']
630 public function testHeadItemsWithSkin() {
633 $res = $this->doApiRequest( [
635 'title' => __CLASS__
,
637 'prop' => 'headitems',
638 'useskin' => 'testing',
641 $this->assertSame( [], $res[0]['parse']['headitems'] );
643 '"prop=headitems" is deprecated since MediaWiki 1.28. ' .
644 'Use "prop=headhtml" when creating new HTML documents, ' .
645 'or "prop=modules|jsconfigvars" when updating a document client-side.',
646 $res[0]['warnings']['parse']['warnings']
650 public function testModules() {
651 $this->setTemporaryHook( 'ParserAfterParse',
652 function ( $parser ) {
653 $output = $parser->getOutput();
654 $output->addModules( [ 'foo', 'bar' ] );
655 $output->addModuleStyles( [ 'aaa', 'zzz' ] );
656 $output->addJsConfigVars( [ 'x' => 'y', 'z' => -3 ] );
659 $res = $this->doApiRequest( [
661 'title' => __CLASS__
,
663 'prop' => 'modules|jsconfigvars|encodedjsconfigvars',
666 $this->assertSame( [ 'foo', 'bar' ], $res[0]['parse']['modules'] );
667 $this->assertSame( [], $res[0]['parse']['modulescripts'] );
668 $this->assertSame( [ 'aaa', 'zzz' ], $res[0]['parse']['modulestyles'] );
669 $this->assertSame( [ 'x' => 'y', 'z' => -3 ], $res[0]['parse']['jsconfigvars'] );
670 $this->assertSame( '{"x":"y","z":-3}', $res[0]['parse']['encodedjsconfigvars'] );
671 $this->assertArrayNotHasKey( 'warnings', $res[0] );
674 public function testModulesWithSkin() {
677 $res = $this->doApiRequest( [
679 'pageid' => self
::$pageId,
680 'useskin' => 'testing',
684 [ 'foo', 'bar', 'baz' ],
685 $res[0]['parse']['modules'],
690 $res[0]['parse']['modulescripts'],
691 'resp.parse.modulescripts'
694 [ 'foo.styles', 'quux.styles' ],
695 $res[0]['parse']['modulestyles'],
696 'resp.parse.modulestyles'
701 'Property "modules" was set but not "jsconfigvars" or ' .
702 '"encodedjsconfigvars". Configuration variables are necessary for ' .
703 'proper module usage.'
710 public function testIndicators() {
711 $res = $this->doApiRequest( [
713 'title' => __CLASS__
,
715 '<indicator name="b">BBB!</indicator>Some text<indicator name="a">aaa</indicator>',
716 'prop' => 'indicators',
720 // It seems we return in markup order and not display order
721 [ 'b' => 'BBB!', 'a' => 'aaa' ],
722 $res[0]['parse']['indicators']
724 $this->assertArrayNotHasKey( 'warnings', $res[0] );
727 public function testIndicatorsWithSkin() {
730 $res = $this->doApiRequest( [
732 'title' => __CLASS__
,
734 '<indicator name="b">BBB!</indicator>Some text<indicator name="a">aaa</indicator>',
735 'prop' => 'indicators',
736 'useskin' => 'testing',
740 // Now we return in display order rather than markup order
741 [ 'a' => 'aaa', 'b' => 'BBB!' ],
742 $res[0]['parse']['indicators']
744 $this->assertArrayNotHasKey( 'warnings', $res[0] );
747 public function testIwlinks() {
748 $this->setupInterwiki();
750 $res = $this->doApiRequest( [
752 'title' => 'Omelette',
753 'text' => '[[:madeuplanguage:Omelette]][[madeuplanguage:Spaghetti]]',
757 $iwlinks = $res[0]['parse']['iwlinks'];
759 $this->assertCount( 1, $iwlinks );
760 $this->assertSame( 'madeuplanguage', $iwlinks[0]['prefix'] );
761 $this->assertSame( 'https://example.com/wiki/Omelette', $iwlinks[0]['url'] );
762 $this->assertSame( 'madeuplanguage:Omelette', $iwlinks[0]['title'] );
763 $this->assertArrayNotHasKey( 'warnings', $res[0] );
766 public function testLimitReports() {
767 $res = $this->doApiRequest( [
769 'pageid' => self
::$pageId,
770 'prop' => 'limitreportdata|limitreporthtml',
773 // We don't bother testing the actual values here
774 $this->assertInternalType( 'array', $res[0]['parse']['limitreportdata'] );
775 $this->assertInternalType( 'string', $res[0]['parse']['limitreporthtml'] );
776 $this->assertArrayNotHasKey( 'warnings', $res[0] );
779 public function testParseTreeNonWikitext() {
780 $this->setExpectedException( ApiUsageException
::class,
781 '"prop=parsetree" is only supported for wikitext content.' );
783 $this->doApiRequest( [
786 'contentmodel' => 'json',
787 'prop' => 'parsetree',
791 public function testParseTree() {
792 $res = $this->doApiRequest( [
794 'text' => "Some ''text'' is {{nice|to have|i=think}}",
795 'contentmodel' => 'wikitext',
796 'prop' => 'parsetree',
799 // Preprocessor_DOM and Preprocessor_Hash give different results here,
800 // so we'll accept either
802 '#^<root>Some \'\'text\'\' is <template><title>nice</title>' .
803 '<part><name index="1"/><value>to have</value></part>' .
804 '<part><name>i</name>(?:<equals>)?=(?:</equals>)?<value>think</value></part>' .
805 '</template></root>$#',
806 $res[0]['parse']['parsetree']
808 $this->assertArrayNotHasKey( 'warnings', $res[0] );
811 public function testDisableTidy() {
812 $this->setMwGlobals( 'wgTidyConfig', [ 'driver' => 'RemexHtml' ] );
814 // Check that disabletidy doesn't have an effect just because tidying
815 // doesn't work for some other reason
816 $res1 = $this->doApiRequest( [
818 'text' => "<b>Mixed <i>up</b></i>",
819 'contentmodel' => 'wikitext',
821 $this->assertParsedTo( "<p><b>Mixed <i>up</i></b>\n</p>", $res1 );
823 $res2 = $this->doApiRequest( [
825 'text' => "<b>Mixed <i>up</b></i>",
826 'contentmodel' => 'wikitext',
830 $this->assertParsedTo( "<p><b>Mixed <i>up</b></i>\n</p>", $res2,
831 'The parameter "disabletidy" has been deprecated.' );
834 public function testFormatCategories() {
835 $name = ucfirst( __FUNCTION__
);
837 $this->editPage( "Category:$name", 'Content' );
838 $this->editPage( 'Category:Hidden', '__HIDDENCAT__' );
840 $res = $this->doApiRequest( [
842 'title' => __CLASS__
,
843 'text' => "[[Category:$name]][[Category:Foo|Sort me]][[Category:Hidden]]",
844 'prop' => 'categories',
848 [ [ 'sortkey' => '', 'category' => $name ],
849 [ 'sortkey' => 'Sort me', 'category' => 'Foo', 'missing' => true ],
850 [ 'sortkey' => '', 'category' => 'Hidden', 'hidden' => true ] ],
851 $res[0]['parse']['categories']
853 $this->assertArrayNotHasKey( 'warnings', $res[0] );