store = $this->getMockBuilder( '\SMW\SQLStore\SQLStore' ) ->disableOriginalConstructor() ->getMock(); } public function testCanConstruct() { $this->assertInstanceOf( PSubjectLookup::class, new PSubjectLookup( $this->store ) ); } /** * @dataProvider lookupProvider */ public function testLookup( $subject, $parameters, $expected ) { $this->store->expects( $this->any() ) ->method( 'getPropertySubjects' ) ->willReturn( [ $subject ] ); $instance = new PSubjectLookup( $this->store ); $res = $instance->lookup( $parameters ); $this->assertEquals( $expected, $res['query'] ); } public function lookupProvider() { yield [ new DIWikiPage( 'Foo bar', NS_MAIN ), [ 'search' => 'Foo', 'property' => 'Bar' ], [ 'Foo bar' ] ]; yield [ new DIWikiPage( 'Foo bar', NS_HELP ), [ 'search' => 'Foo', 'property' => 'Bar', 'title-prefix' => false ], [ 'Foo bar' ] ]; } }