cvs: pear /XML_Feed_Parser package.xml /XML_Feed_Parser/Parser RSS2Element.php /XML_Feed_Parser/tests rss091Values.php rss092Values.php
rss1Values.php
| From: | James Stewart | Date: | Sat, 22 Oct 2005 19:01:20 +0000 |
| Subject: | cvs: pear /XML_Feed_Parser package.xml /XML_Feed_Parser/Parser RSS2Element.php /XML_Feed_Parser/tests rss091Values.php rss092Values.php rss1Values.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35797@lists.php.net to get a copy of this message | ||
jystewart Sat Oct 22 15:01:20 2005 EDT
Added files:
/pear/XML_Feed_Parser/tests rss092Values.php
Modified files:
/pear/XML_Feed_Parser package.xml
/pear/XML_Feed_Parser/Parser RSS2Element.php
/pear/XML_Feed_Parser/tests rss091Values.php rss1Values.php
Log:
Added tests for RSS0.92
Added sample feed for RSS0.92 (from the feed spec)
Updates RSS1.0 and RSS0.91 tests to load system default parser install
Fixed getEnclosure() to receive parameters correctly in RSS2Element.php
http://cvs.php.net/diff.php/pear/XML_Feed_Parser/package.xml?r1=1.5&r2=1.6&ty=u
Index: pear/XML_Feed_Parser/package.xml
diff -u pear/XML_Feed_Parser/package.xml:1.5 pear/XML_Feed_Parser/package.xml:1.6
--- pear/XML_Feed_Parser/package.xml:1.5 Sat Oct 22 13:57:06 2005
+++ pear/XML_Feed_Parser/package.xml Sat Oct 22 15:01:15 2005
@@ -69,6 +69,7 @@
<file name="farsi.php"/>
<file name="errors.php"/>
<file name="rss091Values.php"/>
+ <file name="rss092Values.php"/>
</dir>
<dir name="samples" role="data">
<file name="atom10-example1.xml"/>
http://cvs.php.net/diff.php/pear/XML_Feed_Parser/Parser/RSS2Element.php?r1=1.3&r2=1.4&ty=u
Index: pear/XML_Feed_Parser/Parser/RSS2Element.php
diff -u pear/XML_Feed_Parser/Parser/RSS2Element.php:1.3
pear/XML_Feed_Parser/Parser/RSS2Element.php:1.4
--- pear/XML_Feed_Parser/Parser/RSS2Element.php:1.3 Sun Oct 16 18:49:59 2005
+++ pear/XML_Feed_Parser/Parser/RSS2Element.php Sat Oct 22 15:01:19 2005
@@ -17,7 +17,7 @@
* @author James Stewart <james@jystewart.net>
* @copyright 2005 James Stewart <james@jystewart.net>
* @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
2.1
- * @version CVS: $Id: RSS2Element.php,v 1.3 2005/10/16 22:49:59 jystewart Exp $
+ * @version CVS: $Id: RSS2Element.php,v 1.4 2005/10/22 19:01:19 jystewart Exp $
* @link http://dev.jystewart.net/XML_Feed_Parser/
*/
@@ -110,12 +110,14 @@
* unique in a given entry. For now we will assume it needn't, and allow
* for an offset.
*
- * @param int offset
+ * @param string $method - the method being called
+ * @param array $parameters - we expect the first of these to be our offset
* @return array|false
*/
- protected function getEnclosure($offset = 0)
+ protected function getEnclosure($method, $parameters)
{
$encs = $this->model->getElementsByTagName('enclosure');
+ $offset = isset($parameters[0]) ? $parameters[0] : 0;
if ($encs->length >= $offset) {
try {
$attrs = $encs->item($offset)->attributes;
http://cvs.php.net/diff.php/pear/XML_Feed_Parser/tests/rss091Values.php?r1=1.1&r2=1.2&ty=u
Index: pear/XML_Feed_Parser/tests/rss091Values.php
diff -u pear/XML_Feed_Parser/tests/rss091Values.php:1.1
pear/XML_Feed_Parser/tests/rss091Values.php:1.2
--- pear/XML_Feed_Parser/tests/rss091Values.php:1.1 Sat Oct 22 13:57:10 2005
+++ pear/XML_Feed_Parser/tests/rss091Values.php Sat Oct 22 15:01:19 2005
@@ -1,6 +1,6 @@
<?php
-require_once '../Parser.php';
+require_once 'XML/Feed/Parser.php';
require_once 'PHPUnit.php';
class XML_Feed_Parser_RSS091_valueValidity_TestCase extends PHPUnit_TestCase
http://cvs.php.net/diff.php/pear/XML_Feed_Parser/tests/rss1Values.php?r1=1.1&r2=1.2&ty=u
Index: pear/XML_Feed_Parser/tests/rss1Values.php
diff -u pear/XML_Feed_Parser/tests/rss1Values.php:1.1 pear/XML_Feed_Parser/tests/rss1Values.php:1.2
--- pear/XML_Feed_Parser/tests/rss1Values.php:1.1 Tue Oct 11 10:29:50 2005
+++ pear/XML_Feed_Parser/tests/rss1Values.php Sat Oct 22 15:01:19 2005
@@ -1,6 +1,6 @@
<?php
-require_once '../Parser.php';
+require_once 'XML/Feed/Parser.php';
require_once 'PHPUnit.php';
class XML_Feed_Parser_RSS1_valueValidity_TestCase extends PHPUnit_TestCase
http://cvs.php.net/co.php/pear/XML_Feed_Parser/tests/rss092Values.php?r=1.1&p=1
Index: pear/XML_Feed_Parser/tests/rss092Values.php
+++ pear/XML_Feed_Parser/tests/rss092Values.php
<?php
require_once 'XML/Feed/Parser.php';
require_once 'PHPUnit.php';
class XML_Feed_Parser_RSS092_valueValidity_TestCase extends PHPUnit_TestCase
{
function __construct($name)
{
$this->PHPUnit_TestCase($name);
$this->file = file_get_contents("../samples/rss092-sample.xml");
$this->feed = new XML_Feed_Parser($this->file);
$this->entry = $this->feed->getEntryByOffset(0);
}
function test_feedNumberItems()
{
$value = 22;
$this->assertEquals($value, $this->feed->numberEntries);
}
function test_feedTitle()
{
$value = "Dave Winer: Grateful Dead";
$this->assertEquals($value, $this->feed->title);
}
function test_feedLink()
{
$value = "http://www.scripting.com/blog/categories/gratefulDead.html";
$this->assertEquals($value, $this->feed->link);
}
function test_feedDescription()
{
$value = "A high-fidelity Grateful Dead song every day. This is where we're
experimenting with enclosures on RSS news items that download when you're not using your
computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on
the Internet. ";
$this->assertEquals($value, $this->feed->description);
}
function test_feedSubtitleEquivalence()
{
$value = "A high-fidelity Grateful Dead song every day. This is where we're
experimenting with enclosures on RSS news items that download when you're not using your
computer. If it works (it will) it will be the end of the Click-And-Wait multimedia experience on
the Internet. ";
$this->assertEquals($value, $this->feed->subtitle);
}
function test_feedLastBuildDate()
{
$value = strtotime("Fri, 13 Apr 2001 19:23:02 GMT");
$this->assertEquals($value, $this->feed->lastBuildDate);
}
function test_feedUpdatedEquivalence()
{
$value = strtotime("Fri, 13 Apr 2001 19:23:02 GMT");
$this->assertEquals($value, $this->feed->updated);
}
function test_feedDocs()
{
$value = "http://backend.userland.com/rss092";
$this->assertEquals($value, $this->feed->docs);
}
function test_feedManagingEditor()
{
$value = "dave@userland.com (Dave Winer)";
$this->assertEquals($value, $this->feed->managingEditor);
}
function test_feedAuthorEquivalence()
{
$value = "dave@userland.com (Dave Winer)";
$this->assertEquals($value, $this->feed->author);
}
function test_feedWebmaster()
{
$value = "dave@userland.com (Dave Winer)";
$this->assertEquals($value, $this->feed->webMaster);
}
function test_entryDescription()
{
$value = "It's been a few days since I added a song to the Grateful Dead channel.
Now that there are all these new Radio users, many of whom are tuned into this channel (it's
#16 on the hotlist of upstreaming Radio users, there's no way of knowing how many
non-upstreaming users are subscribing, have to do something about this..). Anyway, tonight's
song is a live version of Weather Report Suite from Dick's Picks Volume 7. It's wistful
music. Of course a beautiful song, oft-quoted here on Scripting News. <i>A little change, the
wind and rain.</i>";
$this->assertEquals($value, trim($this->entry->description));
}
function test_entryEnclosure()
{
$value = array(
'url' => 'http://www.scripting.com/mp3s/weatherReportDicksPicsVol7.mp3',
'length' => '6182912',
'type' => 'audio/mpeg');
$this->assertEquals($value, $this->entry->enclosure);
}
}
$suite = new PHPUnit_TestSuite;
$suite->addTestSuite("XML_Feed_Parser_RSS092_valueValidity_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
?>