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 public function updateText( $text ) {
30 return trim( SearchUpdate
::updateText( $text ) );
34 * @covers SearchUpdate::updateText
36 public function testUpdateText() {
39 $this->updateText( '<div>TeSt</div>' ),
40 'HTML stripped, text lowercased'
45 $this->updateText( <<<EOT
46 <table style="color:red; font-size:100px">
47 <tr class="scary"><td><div>foo</div></td><tr>bar</td></tr>
48 <tr><td>boz</td><tr>quux</td></tr>
51 ), 'Stripping HTML tables' );
55 $this->updateText( 'a > b' ),
56 'Handle unclosed tags'
59 $text = str_pad( "foo <barbarbar \n", 10000, 'x' );
61 $this->assertNotEquals(
63 $this->updateText( $text ),
69 * @covers SearchUpdate::updateText
70 * @todo give this test a real name explaining what is being tested here
72 public function testBug32712() {
73 $text = "text „http://example.com“ text";
74 $result = $this->updateText( $text );
75 $processed = preg_replace( '/Q/u', 'Q', $result );
78 'Link surrounded by unicode quotes should not fail UTF-8 validation'