Permalink
Browse files

Added testItemWithEmptyContent.

  • Loading branch information...
1 parent e60fa05 commit fef8a16c81ba985c9e97de80ac0b8c695ef4da0c @mblaney mblaney committed Nov 24, 2016
Showing with 26 additions and 8 deletions.
  1. +26 −8 tests/ItemTest.php
View
@@ -52,7 +52,7 @@ class ItemTest extends PHPUnit_Framework_TestCase
*
* @param string $template
*/
- protected function checkFromTemplate($template, $data, $expected)
+ protected function checkFromTemplate($template, $data)
{
if (!is_array($data))
{
@@ -103,7 +103,7 @@ public function testTitleRSS20($title, $expected)
<title>%s</title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -118,7 +118,7 @@ public function testTitleRSS20WithDC10($title, $expected)
<dc:title>%s</dc:title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -133,7 +133,7 @@ public function testTitleRSS20WithDC11($title, $expected)
<dc:title>%s</dc:title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -148,7 +148,7 @@ public function testTitleRSS20WithAtom03($title, $expected)
<a:title>%s</a:title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -163,7 +163,7 @@ public function testTitleRSS20WithAtom10($title, $expected)
<a:title>%s</a:title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -183,7 +183,7 @@ public function testTitleRSS20WithImageTitle($title, $expected)
</image>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
@@ -203,7 +203,25 @@ public function testTitleRSS20WithImageTitleReversed($title, $expected)
<title>%s</title>
</channel>
</rss>';
- $feed = $this->checkFromTemplate($data, $title, $expected);
+ $feed = $this->checkFromTemplate($data, $title);
$this->assertEquals($expected, $feed->get_title());
}
+
+ public function testItemWithEmptyContent()
+ {
+ $data =
+'<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+ <channel>
+ <item>
+ <description>%s</description>
+ <content:encoded><![CDATA[ <script> ]]></content:encoded>
+ </item>
+ </channel>
+</rss>';
+ $content = 'item description';
+ $feed = $this->checkFromTemplate($data, $content);
+ $item = $feed->get_item();
+ $this->assertEquals($content, $item->get_content());
+ }
+
}

0 comments on commit fef8a16

Please sign in to comment.