store = $this->getMockBuilder( '\SMW\Store' ) ->disableOriginalConstructor() ->getMockForAbstractClass(); } public function testCanConstruct() { $this->assertInstanceOf( ArticleFromTitle::class, new ArticleFromTitle( $this->store ) ); } /** * @dataProvider namespaceProvider */ public function testProcess( $namespace, $expected ) { $title = $this->createMock( Title::class ); $title->expects( $this->any() ) ->method( 'canExist' ) ->willReturn( true ); $title->expects( $this->atLeastOnce() ) ->method( 'getNamespace' ) ->willReturn( $namespace ); $article = $this->getMockBuilder( '\Article' ) ->disableOriginalConstructor() ->getMock(); $instance = new ArticleFromTitle( $this->store ); $instance->process( $title, $article ); $this->assertInstanceOf( $expected, $article ); } public function namespaceProvider() { $provider[] = [ SMW_NS_PROPERTY, 'SMW\MediaWiki\Page\PropertyPage' ]; $provider[] = [ SMW_NS_CONCEPT, 'SMW\MediaWiki\Page\ConceptPage' ]; return $provider; } }