From 94cca036d6ed2d32dc8312bb04d940457a9d2b26 Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Fri, 14 Jul 2023 11:54:14 +0200 Subject: [PATCH] tests: Clear recentchanges automatically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recentchanges table, as a summary table of revision and logging, should be cleared if either of those tables are cleared. Implement this as a special case – if it was done via $extraTables, then we would clear logging whenever revision is cleared and vice versa, which isn’t necessary. Change-Id: I7b412ac32ae5453a0a1e1716b252e57a5639d5da --- tests/phpunit/MediaWikiIntegrationTestCase.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/phpunit/MediaWikiIntegrationTestCase.php b/tests/phpunit/MediaWikiIntegrationTestCase.php index 5a6ab7bc326..c7226614f68 100644 --- a/tests/phpunit/MediaWikiIntegrationTestCase.php +++ b/tests/phpunit/MediaWikiIntegrationTestCase.php @@ -2098,6 +2098,14 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase { } $extraTables = array_values( $extraTables ); $tablesUsed = array_unique( array_merge( $tablesUsed, ...$extraTables ) ); + // special case: if revision/logging is used, clear recentchanges + // (but not necessarily logging/revision, unless that is also used) + if ( + array_intersect( $tablesUsed, [ 'revision', 'logging' ] ) && + !in_array( 'recentchanges', $tablesUsed, true ) + ) { + $tablesUsed[] = 'recentchanges'; + } if ( in_array( 'user', $tablesUsed ) ) { TestUserRegistry::clear();