diff --git a/src/Suin/RSSWriter/Item.php b/src/Suin/RSSWriter/Item.php
index 309877a..c392100 100644
--- a/src/Suin/RSSWriter/Item.php
+++ b/src/Suin/RSSWriter/Item.php
@@ -108,8 +108,8 @@ public function asXML()
if ($this->guid) {
$guid = $xml->addChild('guid', $this->guid);
- if ($this->isPermalink) {
- $guid->addAttribute('isPermaLink', 'true');
+ if ($this->isPermalink === false) {
+ $guid->addAttribute('isPermaLink', 'false');
}
}
diff --git a/tests/Suin/RSSWriter/ItemTest.php b/tests/Suin/RSSWriter/ItemTest.php
index 7318256..c8ccd18 100644
--- a/tests/Suin/RSSWriter/ItemTest.php
+++ b/tests/Suin/RSSWriter/ItemTest.php
@@ -143,7 +143,52 @@ public function testAsXML()
{$data['description']}
{$data['categories'][0][0]}
{$data['categories'][1][0]}
- {$data['guid']}
+ {$data['guid']}
+ {$nowString}
+
+ {$data['author']}
+
+ ";
+ $this->assertXmlStringEqualsXmlString($expect, $item->asXML()->asXML());
+ }
+
+ public function testAsXML_false_permalink()
+ {
+ $now = time();
+ $nowString = date(DATE_RSS, $now);
+
+ $data = array(
+ 'title' => "Venice Film Festival Tries to Quit Sinking",
+ 'url' => 'http://nytimes.com/2004/12/07FEST.html',
+ 'description' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.",
+ 'categories' => array(
+ array("Grateful Dead", null),
+ array("MSFT", 'http://www.fool.com/cusips'),
+ ),
+ 'guid' => "http://inessential.com/2002/09/01.php#a2",
+ 'isPermalink' => false,
+ 'pubDate' => $now,
+ 'enclosure' => array(
+ 'url' => 'http://link-to-audio-file.com/test.mp3',
+ 'length' => 4992,
+ 'type' => 'audio/mpeg'),
+ 'author' => 'Hidehito Nozawa aka Suin'
+ );
+
+ $item = new Item();
+
+ foreach ($data as $key => $value) {
+ $this->reveal($item)->attr($key, $value);
+ }
+
+ $expect = "
+ -
+ {$data['title']}
+ {$data['url']}
+ {$data['description']}
+ {$data['categories'][0][0]}
+ {$data['categories'][1][0]}
+ {$data['guid']}
{$nowString}
{$data['author']}