parser = $this->getMockBuilder( '\MediaWiki\Parser\Parser' ) ->disableOriginalConstructor() ->getMock(); } public function testCanConstruct() { $this->assertInstanceOf( TemplateExpander::class, new TemplateExpander( $this->parser ) ); } public function testExpand() { $template = new Template( 'Foo' ); $this->parser->expects( $this->once() ) ->method( 'preprocess' ) ->with( '{{Foo}}' ); $instance = new TemplateExpander( $this->parser ); $instance->expand( $template ); } public function testExpandOnInvalidParserThrowsException() { $instance = new TemplateExpander( 'Foo' ); $this->expectException( '\RuntimeException' ); $instance->expand( '' ); } }