getServiceContainer()->getTitleParser()->parseTitle( $title ); $threadItemSet = $this->createParser( $config, $data )->parse( $container, $title ); $pageInfo = TestingAccessWrapper::newFromClass( ApiDiscussionToolsPageInfo::class ); $threadItemsHtml = $pageInfo->getThreadItemsHtml( $threadItemSet, false ); // Optionally write updated content to the JSON files if ( getenv( 'DISCUSSIONTOOLS_OVERWRITE_TESTS' ) ) { static::overwriteJsonFile( $expectedPath, $threadItemsHtml ); } static::assertEquals( $expected, $threadItemsHtml, $name ); } public static function provideGetThreadItemsHtml(): array { return static::getJson( '../cases/threaditemshtml.json' ); } /** * @covers \MediaWiki\Extension\DiscussionTools\ApiDiscussionToolsPageInfo::execute */ public function testExecuteApiDiscussionToolsPageInfo() { $page = $this->getNonexistingTestPage( __METHOD__ ); $this->editPage( $page, 'add DT pageinfo content' ); $params = [ 'action' => 'discussiontoolspageinfo', 'page' => $page->getTitle()->getText(), ]; $result = $this->doApiRequestWithToken( $params ); $this->assertNotEmpty( $result[0]['discussiontoolspageinfo'] ); $this->assertArrayHasKey( 'transcludedfrom', $result[0]['discussiontoolspageinfo'] ); } }