iteration.php
1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once 'XML_Feed_Parser_TestCase.php';
class XML_Feed_Parser_Iteration_TestCase extends XML_Feed_Parser_TestCase
{
    function __construct($name)
    {
        $this->PHPUnit_TestCase($name);
        $this->sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
    }
    
    function setUp() {
    }
    
    function tearDown() {
    }
    
    function test_Atom() {
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $feed = new XML_Feed_Parser(file_get_contents($this->sample_dir . "/grwifi-atom.xml"));
        $entries = array();
        foreach ($feed as $entry) {
            array_push($entries, $entry);
        }
        $this->assertNotSame($entries[0], $entries[1]);
    }
    function test_RSS1() {
        $feed = new XML_Feed_Parser(file_get_contents($this->sample_dir . "/delicious.feed"));
        $entries = array();
        foreach ($feed as $entry) {
            array_push($entries, $entry);
        }
        $this->assertNotSame($entries[0], $entries[1]);
    }
    
    function test_RSS2() {
        $feed = new XML_Feed_Parser(file_get_contents($this->sample_dir . "/rss2sample.xml"));
        $entries = array();
        foreach ($feed as $entry) {
            array_push($entries, $entry);
        }
        $this->assertNotSame($entries[0], $entries[1]);
    }
}
$suite = new PHPUnit_TestSuite;
$suite->addTestSuite("XML_Feed_Parser_Iteration_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
?>