'title1',
'author' => 'author1',
'link' => 'http://example.com/',
'description' => 'description1',
'image' => 'http://example.com/image.jpg',
'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, fetchedAtUnix: 1337);
$expected = [
'title' => 'The title of this Podcast',
'author' => 'The Podcast Author',
'link' => 'http://example.com',
'description' => 'Some long description',
'image' => 'https://example.com/image.jpg',
'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, fetchedAtUnix: 1337);
$expected = [
'title' => 'The title of this Podcast',
'author' => 'The Podcast Author',
'link' => 'http://example.com',
'description' => '',
'image' => '',
'fetchedAtUnix' => 1337,
];
$this->assertSame($expected, $podcastData->toArray());
}
}