Fix test SpecialSearchTest.testSearchTermIsNotExpanded
authorAntoine Musso <hashar@free.fr>
Wed, 10 Oct 2012 09:48:20 +0000 (11:48 +0200)
committerAntoine Musso <hashar@free.fr>
Wed, 10 Oct 2012 09:48:20 +0000 (11:48 +0200)
Ief0bdd10 / 9299bab "Stop expanding search term in <title> of the search
results page" had an issue comparing the site title that could be in
different language.  I have converted the assertion to make sur we
always have the plain search term (aka: {{SITENAME}}) which will work
regardless of the language currently set.

Change-Id: Idbb778174978c17a75fa7671d4967851c2732c15

tests/phpunit/includes/specials/SpecialSearchTest.php

index fed97ad..9d7dc71 100644 (file)
@@ -129,16 +129,13 @@ class SpecialSearchTest extends MediaWikiTestCase {
                        ->getOutput()
                        ->getHTMLTitle();
 
-               # Craft the expected, plain, text:
-               $aPlainSearchTerm =
-                       wfMessage( 'searchresults-title', $term )
-                       ->plain();
-
                # Compare :-]
-               $this->assertStringStartsWith( $aPlainSearchTerm,
+               $this->assertRegExp(
+                       '/' . preg_quote( $term ) . '/',
                        $pageTitle,
-                       "Search term should not be expanded in Special:Search <title>"
+                       "Search term '{$term}' should not be expanded in Special:Search <title>"
                );
+
        }
 }