mediaWikiNsContentReader = $this->getMockBuilder( '\SMW\MediaWiki\MediaWikiNsContentReader' ) ->disableOriginalConstructor() ->getMock(); } public function testCanConstruct() { $this->assertInstanceOf( '\SMW\DataValues\ValueParsers\AllowsPatternValueParser', new AllowsPatternValueParser( $this->mediaWikiNsContentReader ) ); } public function testParseAndMatchFromResource() { $this->mediaWikiNsContentReader->expects( $this->once() ) ->method( 'read' ) ->willReturn( " \nFoo|^(Bar|Foo bar)$\n Bar|^(ABC|DEF)$\n" ); $instance = new AllowsPatternValueParser( $this->mediaWikiNsContentReader ); $this->assertEquals( '^(ABC|DEF)$', $instance->parse( 'Bar' ) ); } }