getServiceContainer() ->getParsoidParserFactory()->create(); if ( is_string( $args[1] ?? '' ) ) { // Make a PageReference from a string $args[1] = Title::newFromText( $args[1] ?? 'Main Page' ); } if ( ( $args[2] ?? null ) === null ) { // Make default ParserOptions if none are provided $args[2] = ParserOptions::newFromAnon(); } $output = $parsoidParser->parse( ...$args ); $html = $output->getText( $getTextOpts ); $this->assertStringContainsString( $expected, $html ); $this->assertSame( $args[1]->getPrefixedDBkey(), $output->getExtensionData( ParsoidParser::PARSOID_TITLE_KEY ) ); $this->assertArrayEquals( [ 'disableContentConversion', 'interfaceMessage', 'wrapclass', 'suppressSectionEditLinks', 'isPreview', 'maxIncludeSize', ], $output->getUsedOptions() ); } public static function provideParsoidParserHtml() { return [ [ [ 'Hello, World' ], 'Hello, World' ], [ [ '__NOTOC__' ], 'getNonexistingTestPage( 'Test' ); $this->editPage( $page, $helloWorld ); $pageTitle = $page->getTitle(); $parsoidParser = $this->getServiceContainer() ->getParsoidParserFactory()->create(); $output = $parsoidParser->parse( $helloWorld, $pageTitle, ParserOptions::newFromAnon(), true, true, $page->getRevisionRecord()->getId() ); $html = $output->getText(); $this->assertStringContainsString( $helloWorld, $html ); $this->assertSame( $pageTitle->getPrefixedDBkey(), $output->getExtensionData( ParsoidParser::PARSOID_TITLE_KEY ) ); $this->assertArrayEquals( [ 'disableContentConversion', 'interfaceMessage', 'isPreview', 'maxIncludeSize', 'suppressSectionEditLinks', 'wrapclass', ], $output->getUsedOptions() ); } }