+ public function testNoHtml() {
+ /** @var MockObject|Content $mockContent */
+ $mockContent = $this->getMockBuilder( WikitextContent::class )
+ ->setMethods( [ 'getParserOutput' ] )
+ ->setConstructorArgs( [ 'Whatever' ] )
+ ->getMock();
+ $mockContent->method( 'getParserOutput' )
+ ->willReturnCallback( function ( Title $title, $revId = null,
+ ParserOptions $options = null, $generateHtml = true
+ ) {
+ if ( !$generateHtml ) {
+ return new ParserOutput( null );
+ } else {
+ $this->fail( 'Should not be called with $generateHtml == true' );
+ return null; // never happens, make analyzer happy
+ }
+ } );
+
+ $title = $this->getMockTitle( 7, 21 );
+
+ $rev = new MutableRevisionRecord( $title );
+ $rev->setContent( 'main', $mockContent );
+ $rev->setContent( 'aux', $mockContent );
+
+ $options = ParserOptions::newCanonical( 'canonical' );
+ $rr = new RenderedRevision( $title, $rev, $options, $this->combinerCallback );
+
+ $output = $rr->getSlotParserOutput( 'main', [ 'generate-html' => false ] );
+ $this->assertFalse( $output->hasText(), 'hasText' );
+
+ $output = $rr->getRevisionParserOutput( [ 'generate-html' => false ] );
+ $this->assertFalse( $output->hasText(), 'hasText' );
+ }
+