Skip to content

Commit

Permalink
Add tests for XML/htmlentities compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-xo committed Feb 7, 2021
1 parent bc2ea27 commit 3e373d1
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions test/PodcastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,29 @@ public function test_feed_with_image()
}


// public function test_html_entities_are_rss_compatible()
// {
// }
public function test_html_entities_are_rss_compatible()
{
$mp = new MyPodcast();

$mp->setTitle('<<<');
$mp->setDescription('⛄️');
$mp->setWebMaster('>>>');
$mp->setGenerator('&amp;');

$content = $mp->generate();
$data = simplexml_load_string($content);

$this->assertEquals('<<<', $data->channel->title);
$this->assertEquals('⛄️', $data->channel->description);
$this->assertEquals('>>>', $data->channel->webMaster);
$this->assertEquals('&amp;', $data->channel->generator);

$this->assertEquals(0, preg_match('/&amp;/', $content));
$this->assertEquals(0, preg_match('/&lt;/', $content));
$this->assertEquals(0, preg_match('/&gt;/', $content));
}

// TODO: these tests overlap with RSS_Item tests

// public function test_added_items()
// {
Expand Down

0 comments on commit 3e373d1

Please sign in to comment.