nextcloud-gpodder/tests/Unit/Core/SubscriptionChange/SubscriptionChangeRequestParserTest.php
thrillfall 72bf365285 parse EpisodeAction message from AntennaPod
persist and list with database

create episodeAction list reponse (with mocked timestamp, started and total)

create episodeActions with received values

update existing episodeActions by unique episode link

receive and store subscription changes

deal with multiple subscription changes in single request

split database into subdirectories

only return subscription changes younger then passed parameter since

parse passed timestamp

parse passed timestamp for episode_actions listing

only return list of urls for subscription changes

align list endpoint naming schema

store userId with episode actions and subscriptions

return json object on application root route
2021-06-27 13:24:17 +02:00

33 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange;
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeRequestParser;
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader;
use PHPUnit_Framework_TestCase;
class SubscriptionChangeRequestParserTest extends PHPUnit_Framework_TestCase {
public function testSubscriptionRequestConvertsToSubscriptionChangeList() {
$subscriptionChangesParser = new SubscriptionChangeRequestParser(
new SubscriptionChangesReader(),
);
$subscriptionChanges = $subscriptionChangesParser->createSubscriptionChangeList('[https://feeds.simplecast.com/54nAGcIl]','[]');
$this->assertCount(1, $subscriptionChanges);
$this->assertSame('https://feeds.simplecast.com/54nAGcIl', $subscriptionChanges[0]->getUrl());
$this->assertTrue($subscriptionChanges[0]->isSubscribed());
}
public function testSubscriptionRequestWithMultipleChangesConvertsToSubscriptionChangeList() {
$subscriptionChangesParser = new SubscriptionChangeRequestParser(
new SubscriptionChangesReader(),
);
$subscriptionChanges = $subscriptionChangesParser->createSubscriptionChangeList(
'[https://podcastfeeds.nbcnews.com/dateline-nbc,https://feeds.megaphone.fm/ADL9840290619]',
'[]');
$this->assertCount(2, $subscriptionChanges);
}
}