Debian Codegraph @

extensions/Echo/tests/phpunit/integration/Push/PushNotifierTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
4
5 use MediaWiki\Extension\Notifications\Push\NotificationRequestJob;
6 use MediaWiki\Extension\Notifications\Push\PushNotifier;
7 use MediaWiki\User\CentralId\CentralIdLookup;
8 use MediaWiki\User\User;
9 use MediaWikiIntegrationTestCase;
10 use Wikimedia\TestingAccessWrapper;
11
12 /** @covers \MediaWiki\Extension\Notifications\Push\PushNotifier */
13 class PushNotifierTest extends MediaWikiIntegrationTestCase {
14
15 public function testCreateJob(): void {
16 $user = $this->createMock( User::class );
17 $centralId = 42;
18 $centralIdLookup = $this->createMock( CentralIdLookup::class );
19 $centralIdLookup->method( 'centralIdFromLocalUser' )
20 ->with( $user )
21 ->willReturn( 42 );
22 $this->setService( 'CentralIdLookup', $centralIdLookup );
23 $notifier = TestingAccessWrapper::newFromClass( PushNotifier::class );
24 $job = $notifier->createJob( $user );
25 $this->assertInstanceOf( NotificationRequestJob::class, $job );
26 $this->assertSame( 'EchoPushNotificationRequest', $job->getType() );
27 $this->assertSame( $centralId, $job->getParams()['centralId'] );
28 }
29
30 }