PHPUnit_TestCase($name);
}
function setUp() {
}
function tearDown() {
}
function test_fakeFeedType()
{
$file = "";
try {
$feed = new XML_Feed_Parser($file, false, true);
} catch (Exception $e) {
$this->assertTrue($e instanceof XML_Feed_Parser_Exception);
}
}
function test_badRSSVersion()
{
$file = "
";
try {
$feed = new XML_Feed_Parser($file, false, true);
} catch (Exception $e) {
$this->assertTrue($e instanceof XML_Feed_Parser_Exception);
}
}
function test_emptyInput()
{
$file = null;
try {
$feed = new XML_Feed_Parser($file, false, true);
} catch (Exception $e) {
$this->assertTrue($e instanceof XML_Feed_Parser_Exception);
}
}
function test_nonXMLInput()
{
$file = "My string";
try {
$feed = new XML_Feed_Parser($file, false, true);
} catch (Exception $e) {
$this->assertTrue($e instanceof XML_Feed_Parser_Exception);
}
}
function test_missingElement() {
$file = '
sample blog
http://www.example.com/
sample rss2 feed
en
Copyright 2006
Tue, 25 Jul 2006 11:53:38 -0500
http://www.sixapart.com/movabletype/?v=3.31
http://blogs.law.harvard.edu/tech/rss
-
A sample entry
Sample content
http://www.example.com/archives/2006/07
http://www.example.com/archives/2006/07
Examples
Tue, 25 Jul 2006 11:53:38 -0500
';
$feed = new XML_Feed_Parser($file, false, true);
$entry = $feed->getEntryByOffset(0);
$this->assertFalse($entry->enclosure());
}
}
$suite = new PHPUnit_TestSuite;
$suite->addTestSuite("XML_Feed_Parser_ThrowErrors_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
?>