mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-12 07:55:53 +00:00
0d8422a569
Use mocks where that makes sense, and add `@group Database` otherwise. Change-Id: I8f8ec8f4b2c73066cc8e7a6f8e38b3fc286a1070
26 lines
949 B
PHP
26 lines
949 B
PHP
<?php
|
|
|
|
use MediaWiki\Extension\Notifications\Push\NotificationRequestJob;
|
|
use MediaWiki\Extension\Notifications\Push\PushNotifier;
|
|
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'] );
|
|
}
|
|
|
|
}
|