2021-06-27 11:19:26 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace OCA\GPodderSync\Tests\Unit\Core\SubscriptionChange;
|
|
|
|
|
|
|
|
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangeRequestParser;
|
|
|
|
use OCA\GPodderSync\Core\SubscriptionChange\SubscriptionChangesReader;
|
2021-07-13 07:43:54 +00:00
|
|
|
use Test\TestCase;
|
2021-06-27 11:19:26 +00:00
|
|
|
|
2021-07-13 07:43:54 +00:00
|
|
|
class SubscriptionChangeRequestParserTest extends TestCase {
|
2021-06-27 11:19:26 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|