mediawiki-extensions-Echo/tests/phpunit/integration/Push/PushNotifierTest.php
Umherirrender a0ca1d89c6 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: Iad87245bf8082193be72f7e482f29e9f1bad11fc
2023-12-11 16:39:00 +01:00

28 lines
1,020 B
PHP

<?php
use MediaWiki\Extension\Notifications\Push\NotificationRequestJob;
use MediaWiki\Extension\Notifications\Push\PushNotifier;
use MediaWiki\User\CentralId\CentralIdLookup;
use MediaWiki\User\User;
use Wikimedia\TestingAccessWrapper;
/** @covers \MediaWiki\Extension\Notifications\Push\PushNotifier */
class PushNotifierTest extends MediaWikiIntegrationTestCase {
public function testCreateJob(): void {
$user = $this->createMock( User::class );
$centralId = 42;
$centralIdLookup = $this->createMock( CentralIdLookup::class );
$centralIdLookup->method( 'centralIdFromLocalUser' )
->with( $user )
->willReturn( 42 );
$this->setService( 'CentralIdLookup', $centralIdLookup );
$notifier = TestingAccessWrapper::newFromClass( PushNotifier::class );
$job = $notifier->createJob( $user );
$this->assertInstanceOf( NotificationRequestJob::class, $job );
$this->assertSame( 'EchoPushNotificationRequest', $job->getType() );
$this->assertSame( $centralId, $job->getParams()['centralId'] );
}
}