getMockBuilder( '\SMW\MediaWiki\MediaWikiNsContentReader' ) ->disableOriginalConstructor() ->getMock(); $this->dataValueServiceFactory = $this->getMockBuilder( '\SMW\Services\DataValueServiceFactory' ) ->disableOriginalConstructor() ->getMock(); $this->dataValueServiceFactory->expects( $this->any() ) ->method( 'getValueParser' ) ->willReturn( new ImportValueParser( $mediaWikiNsContentReader ) ); } public function testCanConstruct() { $this->assertInstanceOf( '\SMW\DataValues\ImportValue', new ImportValue() ); } public function testErrorForInvalidUserValue() { $instance = new ImportValue(); $instance->setDataValueServiceFactory( $this->dataValueServiceFactory ); $instance->setUserValue( 'FooBar' ); $this->assertEquals( 'FooBar', $instance->getWikiValue() ); $this->assertNotEmpty( $instance->getErrors() ); } }