mediawiki-extensions-Echo/tests/phpunit/unit/Push/SubscriptionTest.php
Michael Holloway a5bcc65504 Fix push subscription retrieval
Updates the push subscription query to retrieve a provider string rather
than only its numeric internal ID.

Change-Id: I910173409e48e8b6a6739d3122165c40b0d52b7f
2020-06-08 13:58:42 +02:00

23 lines
691 B
PHP

<?php
use EchoPush\Subscription;
use Wikimedia\Timestamp\ConvertibleTimestamp;
/** @covers \EchoPush\Subscription */
class SubscriptionTest extends MediaWikiUnitTestCase {
public function testNewFromRow(): void {
$row = new stdClass();
$row->eps_token = 'ABC123';
$row->epp_name = 'fcm';
$row->eps_updated = '2020-01-01 10:10:10';
$subscription = Subscription::newFromRow( $row );
$this->assertSame( 'ABC123', $subscription->getToken() );
$this->assertSame( 'fcm', $subscription->getProvider() );
$this->assertInstanceOf( ConvertibleTimestamp::class, $subscription->getUpdated() );
$this->assertSame( '1577873410', $subscription->getUpdated()->getTimestamp() );
}
}