Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | require_once 'XML_Feed_Parser_TestCase.php'; |
---|
4 | |
---|
5 | class XML_Feed_Parser_Tidy_TestCase extends XML_Feed_Parser_TestCase |
---|
6 | { |
---|
7 | |
---|
8 | function __construct($name) |
---|
9 | { |
---|
10 | $this->PHPUnit_TestCase($name); |
---|
11 | } |
---|
12 | |
---|
13 | function setUp() { |
---|
14 | } |
---|
15 | |
---|
16 | function tearDown() { |
---|
17 | } |
---|
18 | |
---|
19 | /** |
---|
20 | * Try to work with this ill-formed feed. If the tidy extension is not installed, |
---|
21 | * it expects parsing to fail. If tidy is installed and parsing fails, the test |
---|
22 | * fails. If tidy is installed and it parses, then the test passes. |
---|
23 | */ |
---|
24 | function test_Tidy() { |
---|
25 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
26 | $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml"); |
---|
27 | try { |
---|
28 | $feed = new XML_Feed_Parser($file, false, true, true); |
---|
29 | } catch (XML_Feed_Parser_Exception $e) { |
---|
30 | if (extension_loaded('tidy')) { |
---|
31 | $this->assertTrue(false); |
---|
32 | } else { |
---|
33 | $this->assertTrue(true); |
---|
34 | } |
---|
35 | return; |
---|
36 | } |
---|
37 | $entry = $feed->getEntryByOffset(0); |
---|
38 | $this->assertEquals($entry->author, 'Example author'); |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | $suite = new PHPUnit_TestSuite; |
---|
43 | $suite->addTestSuite("XML_Feed_Parser_Tidy_TestCase"); |
---|
44 | $result = PHPUnit::run($suite, "123"); |
---|
45 | echo $result->toString(); |
---|
46 | |
---|
47 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.