public function testSearchForGeographicCoordinateValueAsTerm() { if (!defined('SM_VERSION')) { $this->markTestSkipped("Requires 'Geographic coordinate' to be a supported data type (see Semantic Maps)"); } $propertyPage = Title::newFromText('Has coordinates', SMW_NS_PROPERTY); $targetPage = Title::newFromText(__METHOD__); $pageCreator = new PageCreator(); $pageCreator->createPage($propertyPage)->doEdit('[[Has type::Geographic coordinate]]'); $pageCreator->createPage($targetPage)->doEdit("[[Has coordinates::52°31'N, 13°24'E]]"); $search = new Search(); $results = $search->searchTitle("[[Has coordinates::52°31'N, 13°24'E]]"); $this->assertInstanceOf('\\SMW\\MediaWiki\\Search\\SearchResultSet', $results); if (is_a($this->getStore(), '\\SMW\\SPARQLStore\\SPARQLStore')) { $this->markTestIncomplete("Test was marked as incomplete because the SPARQLStore doesn't support the Geo data type"); } $this->assertEquals(1, $results->getTotalHits()); $pageDeleter = new PageDeleter(); $pageDeleter->deletePage($targetPage); $pageDeleter->deletePage($propertyPage); }
public function testSetShowSuggestion() { if (!method_exists('SearchEngine', 'setShowSuggestion')) { $this->markTestSkipped('SearchEngine::setShowSuggestion() is undefined. Probably not yet present in the tested MW version.'); } $searchEngine = $this->getMockBuilder('SearchEngine')->disableOriginalConstructor()->getMock(); $searchEngine->expects($this->once())->method('setShowSuggestion')->with($this->equalTo(true)); $search = new Search(); $search->setFallbackSearchEngine($searchEngine); $search->setShowSuggestion(true); $this->assertTrue($search->getShowSuggestion()); }