mediawiki-extensions-Echo/tests/phpunit/integration/Push/PushNotifierTest.php
James D. Forrester 291ea47dd3 tests: Namespace the PHP classes
This might make dependencies easier to find.

Change-Id: I158fd9f63f18a2b8da0368ac95d5fb5aa9bca3ff
2024-10-03 20:30:06 +00:00

31 lines
1.1 KiB
PHP

<?php
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
use MediaWiki\Extension\Notifications\Push\NotificationRequestJob;
use MediaWiki\Extension\Notifications\Push\PushNotifier;
use MediaWiki\User\CentralId\CentralIdLookup;
use MediaWiki\User\User;
use MediaWikiIntegrationTestCase;
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'] );
}
}