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'] ); } }