6 class SearchUpdateTest
extends MediaWikiTestCase
{
13 protected function setUp() {
15 $this->su
= new SearchUpdate( 0, Title
::newMainPage() );
18 public function updateText( $text ) {
19 return trim( $this->su
->updateText( $text ) );
23 * @covers SearchUpdate::updateText
25 public function testUpdateText() {
28 $this->updateText( '<div>TeSt</div>' ),
29 'HTML stripped, text lowercased'
34 $this->updateText( <<<EOT
35 <table style="color:red; font-size:100px">
36 <tr class="scary"><td><div>foo</div></td><tr>bar</td></tr>
37 <tr><td>boz</td><tr>quux</td></tr>
40 ), 'Stripping HTML tables' );
44 $this->updateText( 'a > b' ),
45 'Handle unclosed tags'
48 $text = str_pad( "foo <barbarbar \n", 10000, 'x' );
50 $this->assertNotEquals(
52 $this->updateText( $text ),
58 * @covers SearchUpdate::updateText
60 * Test if unicode quotes in article links make its search index empty
62 public function testUnicodeLinkSearchIndexError() {
63 $text = "text „http://example.com“ text";
64 $result = $this->updateText( $text );
65 $processed = preg_replace( '/Q/u', 'Q', $result );
68 'Link surrounded by unicode quotes should not fail UTF-8 validation'
73 class MockSearch
extends SearchEngine
{
78 public function update( $id, $title, $text ) {
80 self
::$title = $title;