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\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 SubscriptionChangeReaderTest extends TestCase {
|
2021-07-13 19:36:34 +00:00
|
|
|
public function testMapUrlsToSubscriptionChanges(): void {
|
|
|
|
$subscriptionChange = SubscriptionChangesReader::mapToSubscriptionsChanges(["https://feeds.megaphone.fm/HSW8286374095", "https://feeds.megaphone.fm/another"], true);
|
|
|
|
$this->assertCount(2, $subscriptionChange);
|
2021-07-13 07:43:54 +00:00
|
|
|
$this->assertSame("https://feeds.megaphone.fm/HSW8286374095", $subscriptionChange[0]->getUrl());
|
2021-07-13 19:36:34 +00:00
|
|
|
$this->assertSame("https://feeds.megaphone.fm/another", $subscriptionChange[1]->getUrl());
|
2021-06-27 11:19:26 +00:00
|
|
|
}
|
|
|
|
|
2021-12-09 19:19:35 +00:00
|
|
|
|
|
|
|
public function testNonUrisAreOmmited(): void {
|
|
|
|
$subscriptionChange = SubscriptionChangesReader::mapToSubscriptionsChanges([
|
|
|
|
"https://feeds.megaphone.fm/HSW8286374095",
|
|
|
|
"antennapod_local:content://com.android.externalstorage.documents/tree/home:podcast"
|
|
|
|
], true);
|
|
|
|
$this->assertCount(1, $subscriptionChange);
|
|
|
|
$this->assertSame("https://feeds.megaphone.fm/HSW8286374095", $subscriptionChange[0]->getUrl());
|
|
|
|
}
|
|
|
|
|
2021-06-27 11:19:26 +00:00
|
|
|
}
|