summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/search
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/search')
-rw-r--r--tests/phpunit/includes/search/SearchEngineTest.php14
-rw-r--r--tests/phpunit/includes/search/SearchUpdateTest.php15
2 files changed, 11 insertions, 18 deletions
diff --git a/tests/phpunit/includes/search/SearchEngineTest.php b/tests/phpunit/includes/search/SearchEngineTest.php
index 6abca6d4..87067038 100644
--- a/tests/phpunit/includes/search/SearchEngineTest.php
+++ b/tests/phpunit/includes/search/SearchEngineTest.php
@@ -45,7 +45,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
}
if ( !$this->isWikitextNS( NS_MAIN ) ) {
- //@todo: cover the case of non-wikitext content in the main namespace
+ // @todo cover the case of non-wikitext content in the main namespace
return;
}
@@ -87,6 +87,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
# sort them numerically so we will compare simply that we received
# the expected matches.
sort( $matches );
+
return $matches;
}
@@ -114,7 +115,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
return true;
}
- function testFullWidth() {
+ public function testFullWidth() {
$this->assertEquals(
array( 'FullOneUp', 'FullTwoLow', 'HalfOneUp', 'HalfTwoLow' ),
$this->fetchIds( $this->search->searchText( 'AZ' ) ),
@@ -133,14 +134,14 @@ class SearchEngineTest extends MediaWikiLangTestCase {
"Search for normalized from Full-width Lower" );
}
- function testTextSearch() {
+ public function testTextSearch() {
$this->assertEquals(
array( 'Smithee' ),
$this->fetchIds( $this->search->searchText( 'smithee' ) ),
"Plain search failed" );
}
- function testTextPowerSearch() {
+ public function testTextPowerSearch() {
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(
@@ -151,7 +152,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
"Power search failed" );
}
- function testTitleSearch() {
+ public function testTitleSearch() {
$this->assertEquals(
array(
'Alan Smithee',
@@ -161,7 +162,7 @@ class SearchEngineTest extends MediaWikiLangTestCase {
"Title search failed" );
}
- function testTextTitlePowerSearch() {
+ public function testTextTitlePowerSearch() {
$this->search->setNamespaces( array( 0, 1, 4 ) );
$this->assertEquals(
array(
@@ -172,5 +173,4 @@ class SearchEngineTest extends MediaWikiLangTestCase {
$this->fetchIds( $this->search->searchTitle( 'smithee' ) ),
"Title power search failed" );
}
-
}
diff --git a/tests/phpunit/includes/search/SearchUpdateTest.php b/tests/phpunit/includes/search/SearchUpdateTest.php
index 7d867bc4..2f4fd501 100644
--- a/tests/phpunit/includes/search/SearchUpdateTest.php
+++ b/tests/phpunit/includes/search/SearchUpdateTest.php
@@ -17,6 +17,7 @@ class MockSearch extends SearchEngine {
/**
* @group Search
+ * @group Database
*/
class SearchUpdateTest extends MediaWikiTestCase {
@@ -25,19 +26,11 @@ class SearchUpdateTest extends MediaWikiTestCase {
$this->setMwGlobals( 'wgSearchType', 'MockSearch' );
}
- function update( $text, $title = 'Test', $id = 1 ) {
- $u = new SearchUpdate( $id, $title, $text );
- $u->doUpdate();
- return array( MockSearch::$title, MockSearch::$text );
- }
-
function updateText( $text ) {
- list( , $resultText ) = $this->update( $text );
- $resultText = trim( $resultText ); // abstract from some implementation details
- return $resultText;
+ return trim( SearchUpdate::updateText( $text ) );
}
- function testUpdateText() {
+ public function testUpdateText() {
$this->assertEquals(
'test',
$this->updateText( '<div>TeSt</div>' ),
@@ -69,7 +62,7 @@ EOT
);
}
- function testBug32712() {
+ public function testBug32712() {
$text = "text „http://example.com“ text";
$result = $this->updateText( $text );
$processed = preg_replace( '/Q/u', 'Q', $result );