Merge "Only new vertical format login and signup forms"
[lhc/web/wiklou.git] / tests / phpunit / includes / search / SearchUpdateTest.php
index 935425a..e947c34 100644 (file)
@@ -17,33 +17,17 @@ class MockSearch extends SearchEngine {
 
 /**
  * @group Search
+ * @group Database
  */
 class SearchUpdateTest extends MediaWikiTestCase {
-       static $searchType;
 
-       function update( $text, $title = 'Test', $id = 1 ) {
-               $u = new SearchUpdate( $id, $title, $text );
-               $u->doUpdate();
-               return array( MockSearch::$title, MockSearch::$text );
+       protected function setUp() {
+               parent::setUp();
+               $this->setMwGlobals( 'wgSearchType', 'MockSearch' );
        }
 
        function updateText( $text ) {
-               list( , $resultText ) = $this->update( $text );
-               $resultText = trim( $resultText ); // abstract from some implementation details
-               return $resultText;
-       }
-
-       function setUp() {
-               global $wgSearchType;
-
-               self::$searchType  = $wgSearchType;
-               $wgSearchType = 'MockSearch';
-       }
-
-       function tearDown() {
-               global $wgSearchType;
-
-               $wgSearchType = self::$searchType;
+               return trim( SearchUpdate::updateText( $text ) );
        }
 
        function testUpdateText() {
@@ -77,4 +61,14 @@ EOT
                        'Bug 18609'
                );
        }
+
+       function testBug32712() {
+               $text = "text „http://example.com“ text";
+               $result = $this->updateText( $text );
+               $processed = preg_replace( '/Q/u', 'Q', $result );
+               $this->assertTrue(
+                       $processed != '',
+                       'Link surrounded by unicode quotes should not fail UTF-8 validation'
+               );
+       }
 }