2020-06-02 23:21:36 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-22 15:31:00 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications\Test\Integration\Push;
|
|
|
|
|
2022-11-13 07:53:42 +00:00
|
|
|
use MediaWiki\Extension\Notifications\Services;
|
2024-02-22 15:31:00 +00:00
|
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
use MockHttpTrait;
|
|
|
|
use MWHttpRequest;
|
2020-06-02 23:21:36 +00:00
|
|
|
use Wikimedia\TestingAccessWrapper;
|
|
|
|
|
2022-04-08 00:38:27 +00:00
|
|
|
/** @covers \MediaWiki\Extension\Notifications\Push\NotificationServiceClient */
|
2020-06-02 23:21:36 +00:00
|
|
|
class NotificationServiceClientTest extends MediaWikiIntegrationTestCase {
|
2020-09-21 20:50:32 +00:00
|
|
|
use MockHttpTrait;
|
2020-06-02 23:21:36 +00:00
|
|
|
|
|
|
|
public function testConstructRequest(): void {
|
2020-09-21 20:50:32 +00:00
|
|
|
$this->installMockHttp( 'hi' );
|
|
|
|
|
2022-11-13 07:53:42 +00:00
|
|
|
$client = Services::getInstance()->getPushNotificationServiceClient();
|
2020-06-02 23:21:36 +00:00
|
|
|
$client = TestingAccessWrapper::newFromObject( $client );
|
|
|
|
$payload = [ 'deviceTokens' => [ 'foo' ], 'messageType' => 'checkEchoV1' ];
|
|
|
|
$request = $client->constructRequest( 'fcm', $payload );
|
|
|
|
$this->assertInstanceOf( MWHttpRequest::class, $request );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|