'title1',
'author' => 'author1',
'link' => 'http://example.com/',
'description' => 'description1',
'imageUrl' => 'http://example.com/image.jpg',
'imageBlob' => null,
'fetchedAtUnix' => 1337,
];
$this->assertSame($expected, $podcastData->toArray());
}
public function testFromArray(): void {
$podcastData = new PodcastData('title1', 'author1', 'http://example.com/', 'description1', 'http://example.com/image.jpg', 1337);
$expected = $podcastData->toArray();
$fromArray = PodcastData::fromArray($expected);
$this->assertSame($expected, $fromArray->toArray());
}
public function testParseRssXml(): void {
$xml = '
The title of this Podcast
All rights reserved
http://example.com
en-us
Some long description
The Podcast Author
Some long description
no
nextcloud, gpodder
Owner of the podcast
editors@example.com
Support our work
thrillfall
jilleJr
';
$podcastData = PodcastData::parseRssXml($xml, 1337);
$expected = [
'title' => 'The title of this Podcast',
'author' => 'The Podcast Author',
'link' => 'http://example.com',
'description' => 'Some long description',
'imageUrl' => 'https://example.com/image.jpg',
'imageBlob' => null,
'fetchedAtUnix' => 1337,
];
$this->assertSame($expected, $podcastData->toArray());
}
public function testParseRssXmlPartial(): void {
$xml = '
The title of this Podcast
All rights reserved
http://example.com
The Podcast Author
Some image
';
$podcastData = PodcastData::parseRssXml($xml, 1337);
$expected = [
'title' => 'The title of this Podcast',
'author' => 'The Podcast Author',
'link' => 'http://example.com',
'description' => null,
'imageUrl' => null,
'imageBlob' => null,
'fetchedAtUnix' => 1337,
];
$this->assertSame($expected, $podcastData->toArray());
}
}