The translate extension registers the LanguageLinks hook which is run by
OutputPage::addParserOutputMetadata with a Title as an argument. If
our mock doesn't provide a valid Title, then
PageTranslationHooks::addLanguageLinks() in Translate will throw a
TypeError in OutputPageTest::testParserOutputCategoryLinks().
Change-Id: I495c51731670f841e5ab752a3a1e014c86ef643d
$op = $this->getMockBuilder( OutputPage::class )
->setConstructorArgs( [ new RequestContext() ] )
- ->setMethods( [ 'addCategoryLinksToLBAndGetResult' ] )
+ ->setMethods( [ 'addCategoryLinksToLBAndGetResult', 'getTitle' ] )
->getMock();
+ $title = Title::newFromText( 'My test page' );
+ $op->expects( $this->any() )
+ ->method( 'getTitle' )
+ ->will( $this->returnValue( $title ) );
+
$op->expects( $this->any() )
->method( 'addCategoryLinksToLBAndGetResult' )
->will( $this->returnCallback( function ( array $categories ) use ( $fakeResults ) {