| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require_once 'XML_Feed_Parser_TestCase.php';
|
|
|
4 |
|
|
|
5 |
class MalformedFeedTest extends XML_Feed_Parser_TestCase
|
|
|
6 |
{
|
|
|
7 |
/**
|
|
|
8 |
* Try to work with this ill-formed feed. If the tidy extension is not installed,
|
|
|
9 |
* it expects parsing to fail. If tidy is installed and parsing fails, the test
|
|
|
10 |
* fails. If tidy is installed and it parses, then the test passes.
|
|
|
11 |
*/
|
|
|
12 |
function test_Tidy() {
|
|
|
13 |
if (!extension_loaded('tidy')) {
|
|
|
14 |
$this->markTestSkipped("You need the tidy extension installed to run this test");
|
|
|
15 |
}
|
|
|
16 |
|
|
|
17 |
$sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
|
|
|
18 |
$file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml");
|
|
|
19 |
|
|
|
20 |
$feed = new XML_Feed_Parser($file, false, true, true);
|
|
|
21 |
|
|
|
22 |
$entry = $feed->getEntryByOffset(0);
|
|
|
23 |
$this->assertEquals($entry->author, 'Example author');
|
|
|
24 |
}
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
?>
|