3 class MockSearch
extends SearchEngine
{
8 public function __construct( $db ) {
11 public function update( $id, $title, $text ) {
13 self
::$title = $title;
22 class SearchUpdateTest
extends MediaWikiTestCase
{
24 protected function setUp() {
26 $this->setMwGlobals( 'wgSearchType', 'MockSearch' );
29 function updateText( $text ) {
30 return trim( SearchUpdate
::updateText( $text ) );
33 function testUpdateText() {
36 $this->updateText( '<div>TeSt</div>' ),
37 'HTML stripped, text lowercased'
42 $this->updateText( <<<EOT
43 <table style="color:red; font-size:100px">
44 <tr class="scary"><td><div>foo</div></td><tr>bar</td></tr>
45 <tr><td>boz</td><tr>quux</td></tr>
48 ), 'Stripping HTML tables' );
52 $this->updateText( 'a > b' ),
53 'Handle unclosed tags'
56 $text = str_pad( "foo <barbarbar \n", 10000, 'x' );
58 $this->assertNotEquals(
60 $this->updateText( $text ),
65 function testBug32712() {
66 $text = "text „http://example.com“ text";
67 $result = $this->updateText( $text );
68 $processed = preg_replace( '/Q/u', 'Q', $result );
71 'Link surrounded by unicode quotes should not fail UTF-8 validation'