aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit
diff options
context:
space:
mode:
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>2025-03-20 21:00:31 +0000
committerGerrit Code Review <gerrit@wikimedia.org>2025-03-20 21:00:31 +0000
commit5ebbaf5822afdd87a210ca35c65c1ecb05773d6a (patch)
tree36d091b8e5fe4ef8863674ce93c3e5063de11f02 /tests/phpunit
parent8658a076eabfd5caf054c39fa9523682a4fe307e (diff)
parentcfd67eccba8f7e0c7eaae59617b6823e84281001 (diff)
downloadmediawikicore-5ebbaf5822afdd87a210ca35c65c1ecb05773d6a.tar.gz
mediawikicore-5ebbaf5822afdd87a210ca35c65c1ecb05773d6a.zip
Merge "PageUpdater: move revert tag update logic"
Diffstat (limited to 'tests/phpunit')
-rw-r--r--tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php37
-rw-r--r--tests/phpunit/includes/Storage/PageUpdaterTest.php4
2 files changed, 22 insertions, 19 deletions
diff --git a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
index 0c4b2ad6d968..2338bf3ed8de 100644
--- a/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
+++ b/tests/phpunit/includes/Storage/DerivedPageDataUpdaterTest.php
@@ -44,6 +44,7 @@ use MediaWikiIntegrationTestCase;
use MockTitleTrait;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\MockObject\MockObject;
+use RecentChange;
use Wikimedia\ObjectCache\BagOStuff;
use Wikimedia\Rdbms\Platform\ISQLPlatform;
use Wikimedia\TestingAccessWrapper;
@@ -1423,17 +1424,24 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
public static function provideEnqueueRevertedTagUpdateJob() {
return [
- 'approved' => [ true, 1 ],
- 'not approved' => [ false, 0 ]
+ 'not patrolled' => [ true, 0, 0 ],
+ 'patrolled' => [ true, RecentChange::PRC_AUTOPATROLLED, 1 ],
+ 'autopatrolled' => [ true, RecentChange::PRC_AUTOPATROLLED, 1 ],
+ 'patrolling disabled' => [ false, 0, 1 ]
];
}
/**
* @covers \MediaWiki\Storage\DerivedPageDataUpdater::doUpdates
- * @covers \MediaWiki\Storage\DerivedPageDataUpdater::maybeEnqueueRevertedTagUpdateJob
+ * @covers \MediaWiki\RecentChanges\ChangeTrackingEventIngress::updateRevertTagAfterPageUpdated
* @dataProvider provideEnqueueRevertedTagUpdateJob
*/
- public function testEnqueueRevertedTagUpdateJob( bool $approved, int $queueSize ) {
+ public function testEnqueueRevertedTagUpdateJob(
+ bool $useRcPatrol,
+ int $rcPatrolStatus,
+ int $expectQueueSize
+ ) {
+ $this->overrideConfigValue( MainConfigNames::UseRCPatrol, $useRcPatrol );
$page = $this->getPage( __METHOD__ );
$content = [ SlotRecord::MAIN => new WikitextContent( '1' ) ];
@@ -1453,7 +1461,7 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
$updater->prepareUpdate( $rev, [
'editResult' => $editResult,
- 'approved' => $approved
+ 'rcPatrolStatus' => $rcPatrolStatus,
] );
$updater->doUpdates();
@@ -1467,23 +1475,16 @@ class DerivedPageDataUpdaterTest extends MediaWikiIntegrationTestCase {
)
);
- if ( $approved ) {
- $this->assertNull(
- $editResultCache->get( $rev->getId() ),
- 'EditResult should not be cached when the revert is approved'
- );
- } else {
- $this->assertEquals(
- $editResult,
- $editResultCache->get( $rev->getId() ),
- 'EditResult should be cached when the revert is not approved'
- );
- }
+ $this->assertEquals(
+ $editResult,
+ $editResultCache->get( $rev->getId() ),
+ 'EditResult should be cached when the revert is not approved'
+ );
$jobQueueGroup = $this->getServiceContainer()->getJobQueueGroup();
$jobQueue = $jobQueueGroup->get( 'revertedTagUpdate' );
$this->assertSame(
- $queueSize,
+ $expectQueueSize,
$jobQueue->getSize()
);
}
diff --git a/tests/phpunit/includes/Storage/PageUpdaterTest.php b/tests/phpunit/includes/Storage/PageUpdaterTest.php
index 7b4892c8f757..30cd345e604e 100644
--- a/tests/phpunit/includes/Storage/PageUpdaterTest.php
+++ b/tests/phpunit/includes/Storage/PageUpdaterTest.php
@@ -1418,7 +1418,9 @@ class PageUpdaterTest extends MediaWikiIntegrationTestCase {
$services->getWikiPageFactory(),
$services->getHookContainer(),
$services->getUserNameUtils(),
- $services->getTalkPageNotificationManager()
+ $services->getTalkPageNotificationManager(),
+ $services->getMainConfig(),
+ $services->getJobQueueGroup()
);
$services->getDomainEventSource()