aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/deferred
diff options
context:
space:
mode:
authorTimo Tijhof <krinkle@fastmail.com>2024-11-14 13:41:51 +0000
committerTimo Tijhof <krinkle@fastmail.com>2024-11-26 19:13:51 +0000
commit2a8e0668b2d016e5b8f2960e21b11f291a4e1673 (patch)
tree9be39905fc0d5b1d20c8d7ebf55124e31d8f6111 /tests/phpunit/includes/deferred
parentbbde95ad3a3f1d100749fbb7fc5483d78eb90db9 (diff)
downloadmediawikicore-2a8e0668b2d016e5b8f2960e21b11f291a4e1673.tar.gz
mediawikicore-2a8e0668b2d016e5b8f2960e21b11f291a4e1673.zip
search: Move SearchUpdate.php to /includes/search directory
The class was introduced for and is exclusively used by the Search component, and is already documented as part of the Search docgroup. It was placed under the deferred directory because, 10+ years ago, we used to treat MediaWiki as something that (mostly) a single team can maintain and look after, but this has changed a lot since then. * Mark the class as internal. I can't think of a use case outside of core, and indeed it has no references outside core (per Codesearch/Everywhere). Follows-up Ibd40734b9, which namespaced this class under Deferred. Remove both the global class alias and the Deferred alias, since the class is now internal and requires no back compat aliases. Bug: T364652 Change-Id: I48937dcda4144e5e039c38a2e336f8361e2d492d
Diffstat (limited to 'tests/phpunit/includes/deferred')
-rw-r--r--tests/phpunit/includes/deferred/SearchUpdateTest.php71
1 files changed, 0 insertions, 71 deletions
diff --git a/tests/phpunit/includes/deferred/SearchUpdateTest.php b/tests/phpunit/includes/deferred/SearchUpdateTest.php
deleted file mode 100644
index 33a9b3b58051..000000000000
--- a/tests/phpunit/includes/deferred/SearchUpdateTest.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-use MediaWiki\Deferred\SearchUpdate;
-use MediaWiki\Page\PageIdentityValue;
-
-/**
- * @group Search
- * @covers \MediaWiki\Deferred\SearchUpdate
- */
-class SearchUpdateTest extends MediaWikiIntegrationTestCase {
-
- /**
- * @var SearchUpdate
- */
- private $su;
-
- protected function setUp(): void {
- parent::setUp();
- $pageIdentity = new PageIdentityValue( 42, NS_MAIN, 'Main_Page', PageIdentityValue::LOCAL );
- $this->su = new SearchUpdate( 0, $pageIdentity );
- }
-
- public function updateText( $text ) {
- return trim( $this->su->updateText( $text ) );
- }
-
- public function testUpdateText() {
- $this->assertEquals(
- 'test',
- $this->updateText( '<div>TeSt</div>' ),
- 'HTML stripped, text lowercased'
- );
-
- $this->assertEquals(
- 'foo bar boz quux',
- $this->updateText( <<<EOT
-<table style="color:red; font-size:100px">
- <tr class="scary"><td><div>foo</div></td><tr>bar</td></tr>
- <tr><td>boz</td><tr>quux</td></tr>
-</table>
-EOT
- ), 'Stripping HTML tables' );
-
- $this->assertEquals(
- 'a b',
- $this->updateText( 'a > b' ),
- 'Handle unclosed tags'
- );
-
- $text = str_pad( "foo <barbarbar \n", 10000, 'x' );
-
- $this->assertNotEquals(
- '',
- $this->updateText( $text ),
- 'T20609'
- );
- }
-
- /**
- * T34712: Test if unicode quotes in article links make its search index empty
- */
- public function testUnicodeLinkSearchIndexError() {
- $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'
- );
- }
-}