cvs: pear /XML_RSS package.xml /XML_RSS/tests 01-parse.phpt XML_RSS_Infrastructure_Test.php XML_RSS_Parsing_Test.php

From: Date: Fri, 05 Nov 2004 17:26:32 +0000
Subject: cvs: pear /XML_RSS package.xml /XML_RSS/tests 01-parse.phpt XML_RSS_Infrastructure_Test.php XML_RSS_Parsing_Test.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-25710@lists.php.net to get a copy of this message
mj Fri Nov 5 12:26:32 2004 EDT Added files: /pear/XML_RSS/tests XML_RSS_Infrastructure_Test.php XML_RSS_Parsing_Test.php Removed files: /pear/XML_RSS/tests 01-parse.phpt Modified files: /pear/XML_RSS package.xml Log: * Added some basic unit tests. http://cvs.php.net/diff.php/pear/XML_RSS/package.xml?r1=1.17&r2=1.18&ty=u Index: pear/XML_RSS/package.xml diff -u pear/XML_RSS/package.xml:1.17 pear/XML_RSS/package.xml:1.18 --- pear/XML_RSS/package.xml:1.17 Fri Nov 5 12:02:48 2004 +++ pear/XML_RSS/package.xml Fri Nov 5 12:26:31 2004 @@ -35,7 +35,8 @@ <dir name="/" baseinstalldir="XML"> <file role="php" name="RSS.php" /> <dir name="tests" role="test"> - <file name="01-parse.phpt" /> + <file name="XML_RSS_Infrastructure_Test.php" /> + <file name="XML_RSS_Parsing_Test.php" /> <file name="test.rss" /> </dir> </dir> http://cvs.php.net/co.php/pear/XML_RSS/tests/XML_RSS_Infrastructure_Test.php?r=1.1&p=1 Index: pear/XML_RSS/tests/XML_RSS_Infrastructure_Test.php +++ pear/XML_RSS/tests/XML_RSS_Infrastructure_Test.php <?php // +------------------------------------------------------------------------+ // | PEAR :: XML_RSS | // +------------------------------------------------------------------------+ // | Copyright (c) 2004 Martin Jansen | // +------------------------------------------------------------------------+ // | This source file is subject to version 3.00 of the PHP License, | // | that is available at http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // // $Id: XML_RSS_Infrastructure_Test.php,v 1.1 2004/11/05 17:26:28 mj Exp $ // require_once "PHPUnit.php"; require_once "PHPUnit/TestCase.php"; require_once "PHPUnit/TestSuite.php"; require_once "XML/RSS.php"; /** * Unit test suite for the XML_RSS package * * This test suite does not provide tests that make sure that XML_RSS * parses XML files correctly. It only ensures that the "infrastructure" * works fine. * * @author Martin Jansen <mj@php.net> * @extends PHPUnit_TestCase * @version $Id: XML_RSS_Infrastructure_Test.php,v 1.1 2004/11/05 17:26:28 mj Exp $ */ class XML_RSS_Infrastructure_Test extends PHPUnit_TestCase { /** * Test case for making sure that XML_RSS extends from XML_Parser */ function testIsXML_Parser() { $rss =& new XML_RSS(); $this->assertTrue(is_a($rss, "XML_Parser")); } /** * Test case for bug report #2310 * * @link http://pear.php.net/bugs/2310/ */ function testBug2310() { $rss =& new XML_RSS("", null, "utf-8"); $this->assertEquals($rss->tgtenc, "utf-8"); $rss =& new XML_RSS("", "utf-8", "iso-8859-1"); $this->assertEquals($rss->srcenc, "utf-8"); $this->assertEquals($rss->tgtenc, "iso-8859-1"); } } $suite = new PHPUnit_TestSuite("XML_RSS_Infrastructure_Test"); $result = PHPUnit::run($suite); echo $result->toString(); http://cvs.php.net/co.php/pear/XML_RSS/tests/XML_RSS_Parsing_Test.php?r=1.1&p=1 Index: pear/XML_RSS/tests/XML_RSS_Parsing_Test.php +++ pear/XML_RSS/tests/XML_RSS_Parsing_Test.php <?php // +------------------------------------------------------------------------+ // | PEAR :: XML_RSS | // +------------------------------------------------------------------------+ // | Copyright (c) 2004 Martin Jansen | // +------------------------------------------------------------------------+ // | This source file is subject to version 3.00 of the PHP License, | // | that is available at http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // // $Id: XML_RSS_Parsing_Test.php,v 1.1 2004/11/05 17:26:28 mj Exp $ // require_once "PHPUnit.php"; require_once "PHPUnit/TestCase.php"; require_once "PHPUnit/TestSuite.php"; require_once "XML/RSS.php"; /** * Unit test suite for the XML_RSS package * * @author Martin Jansen <mj@php.net> * @extends PHPUnit_TestCase * @version $Id: XML_RSS_Parsing_Test.php,v 1.1 2004/11/05 17:26:28 mj Exp $ */ class XML_RSS_Parsing_Test extends PHPUnit_TestCase { function testParseLocalFile() { $result = array("PHP homepage" => "http://php.net/", "PEAR homepage" => "http://pear.php.net/", "PHP-GTK homepage" => "http://gtk.php.net/", "PHP QA homepage" => "http://qa.php.net/"); $values = array_values($result); $keys = array_keys($result); $i = 0; $r =& new XML_RSS("test.rss"); $r->parse(); $this->assertEquals(count($r->getItems()), 4); foreach ($r->getItems() as $value) { $this->assertEquals($value['title'], $keys[$i]); $this->assertEquals($value['link'], $values[$i]); $i++; } } } $suite = new PHPUnit_TestSuite("XML_RSS_Parsing_Test"); $result = PHPUnit::run($suite); echo $result->toString();

« previous php.pear.cvs (#25710) next »