diff options
Diffstat (limited to 'Echo/tests/phpunit/integration/Push/SubscriptionManagerTest.php')
-rw-r--r-- | Echo/tests/phpunit/integration/Push/SubscriptionManagerTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Echo/tests/phpunit/integration/Push/SubscriptionManagerTest.php b/Echo/tests/phpunit/integration/Push/SubscriptionManagerTest.php new file mode 100644 index 00000000..7a9f32f1 --- /dev/null +++ b/Echo/tests/phpunit/integration/Push/SubscriptionManagerTest.php @@ -0,0 +1,27 @@ +<?php + +/** + * @group Database + * @covers \EchoPush\SubscriptionManager + */ +class SubscriptionManagerTest extends MediaWikiIntegrationTestCase { + + public function setUp(): void { + parent::setUp(); + $this->tablesUsed[] = 'echo_push_subscription'; + $this->tablesUsed[] = 'echo_push_provider'; + } + + public function testManagePushSubscriptions(): void { + $subscriptionManager = EchoServices::getInstance()->getPushSubscriptionManager(); + $user = $this->getTestUser()->getUser(); + $centralId = CentralIdLookup::factory()->centralIdFromLocalUser( $user ); + $subscriptionManager->create( $user, 'test', 'ABC123' ); + $subscriptions = $subscriptionManager->getSubscriptionsForUser( $centralId ); + $this->assertCount( 1, $subscriptions ); + $subscriptionManager->delete( $user, 'ABC123' ); + $subscriptions = $subscriptionManager->getSubscriptionsForUser( $centralId ); + $this->assertCount( 0, $subscriptions ); + } + +} |