Page MenuHomeWickedGov Phorge

PageIngressTest.php
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

PageIngressTest.php

<?php
namespace MediaWiki\Extension\Notifications\Test;
use MediaWiki\Extension\Notifications\Mapper\EventMapper;
use MediaWiki\Extension\Notifications\Mapper\NotificationMapper;
use MediaWiki\Extension\Notifications\MediaWikiEventIngress\PageEventIngress;
use MediaWiki\Page\Event\PageDeletedEvent;
use MediaWiki\Page\ExistingPageRecord;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Revision\RevisionStore;
use MediaWiki\User\UserEditTracker;
use MediaWiki\User\UserIdentityValue;
use MediaWikiIntegrationTestCase;
class PageIngressTest extends MediaWikiIntegrationTestCase {
/**
* @covers \MediaWiki\Extension\Notifications\MediaWikiEventIngress\PageEventIngress
*/
public function testDeletedPage() {
$pageRecordBefore = $this->createMock( ExistingPageRecord::class );
$pageRecordBefore->method( 'exists' )->willReturn( true );
$latestRevisionBefore = $this->createMock( RevisionRecord::class );
$user = new UserIdentityValue( 0, "User" );
$event = new PageDeletedEvent(
$pageRecordBefore,
$latestRevisionBefore,
$user,
[], [], "", "", 1
);
$revisionStore = $this->createMock( RevisionStore::class );
$userEditTracker = $this->createMock( UserEditTracker::class );
$eventMapper = $this->createMock( EventMapper::class );
$eventIdsForModeration = [ 1, 2, 3 ];
$eventMapper->expects( $this->once() )
->method( 'fetchIdsByPage' )
->willReturn( $eventIdsForModeration );
$eventMapper->expects( $this->once() )
->method( 'toggleDeleted' )
->with( $eventIdsForModeration, true );
$this->setService( 'EchoEventMapper', $eventMapper );
$notificationMapper = $this->createMock( NotificationMapper::class );
$notificationMapper->expects( $this->once() )
->method( 'fetchUsersWithNotificationsForEvents' )
->with( $eventIdsForModeration )
->willReturn( [] );
$this->setService( 'EchoNotificationMapper', $notificationMapper );
$pageEventIngress = new PageEventIngress(
$revisionStore, $userEditTracker,
$eventMapper
);
$pageEventIngress->handlePageDeletedEvent( $event );
}
}

File Metadata

Mime Type
text/x-php
Expires
Oct 4 2026, 07:45 (5 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
97/84/3421e1fb453ec5616404869cf049
Default Alt Text
PageIngressTest.php (2 KB)

Event Timeline