source: branches/beta/html/test/adachi/LLReader/Lib/XML/Feed/tests/convertedtests/namespace.php @ 14676

Revision 14676, 4.0 KB checked in by adati, 17 years ago (diff)

1.4.0a-betaのマージ

Line 
1<?php
2
3require_once 'XML_Feed_Parser_TestCase.php';
4
5class namespace_TestCase extends XML_Feed_Parser_Converted_TestCase {
6
7    function test_rss1_0withModules_1 () {
8        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss1.0withModules.xml');
9        try {
10            $feed = new XML_Feed_Parser($content);
11        } catch (XML_Feed_Parser_Exception $e) {
12            $this->assertTrue(false);
13            return;
14        }
15        $this->assertEquals('Test Item - RSS 1.0', $feed->getEntryByOffset(0)->title);
16    }
17
18    function test_rss1_0withModulesNoDefNS_1 () {
19        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss1.0withModulesNoDefNS.xml');
20        try {
21            $feed = new XML_Feed_Parser($content);
22        } catch (XML_Feed_Parser_Exception $e) {
23            $this->assertTrue(false);
24            return;
25        }
26        $this->assertEquals('Test Item - RSS 1.0 no Default NS', $feed->getEntryByOffset(0)->title);
27    }
28
29    function test_rss1_0withModulesNoDefNSLocalNameClash_1 () {
30        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss1.0withModulesNoDefNSLocalNameClash.xml');
31        try {
32            $feed = new XML_Feed_Parser($content);
33        } catch (XML_Feed_Parser_Exception $e) {
34            $this->assertTrue(false);
35            return;
36        }
37        $this->assertEquals('correct description', $feed->getEntryByOffset(0)->description);
38    }
39
40    function test_rss2_0noNSwithModules_1 () {
41        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss2.0noNSwithModules.xml');
42        try {
43            $feed = new XML_Feed_Parser($content);
44        } catch (XML_Feed_Parser_Exception $e) {
45            $this->assertTrue(false);
46            return;
47        }
48        $this->assertEquals('Test Item - RSS 2.0 no NS', $feed->getEntryByOffset(0)->title);
49    }
50
51    function test_rss2_0noNSwithModulesLocalNameClash_1 () {
52        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss2.0noNSwithModulesLocalNameClash.xml');
53        try {
54            $feed = new XML_Feed_Parser($content);
55        } catch (XML_Feed_Parser_Exception $e) {
56            $this->assertTrue(false);
57            return;
58        }
59        $this->assertEquals('correct description', $feed->getEntryByOffset(0)->description);
60    }
61
62    function test_rss2_0NSwithModules_1 () {
63        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss2.0NSwithModules.xml');
64        try {
65            $feed = new XML_Feed_Parser($content);
66        } catch (XML_Feed_Parser_Exception $e) {
67            $this->assertTrue(false);
68            return;
69        }
70        $this->assertEquals('Test Item - RSS2.0 w/ NS', $feed->getEntryByOffset(0)->title);
71    }
72
73    function test_rss2_0NSwithModulesNoDefNS_1 () {
74        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss2.0NSwithModulesNoDefNS.xml');
75        try {
76            $feed = new XML_Feed_Parser($content);
77        } catch (XML_Feed_Parser_Exception $e) {
78            $this->assertTrue(false);
79            return;
80        }
81        $this->assertEquals('Test Item - - RSS2.0 w/ NS no default NS', $feed->getEntryByOffset(0)->title);
82    }
83
84    function test_rss2_0NSwithModulesNoDefNSLocalNameClash_1 () {
85        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/namespace/rss2.0NSwithModulesNoDefNSLocalNameClash.xml');
86        try {
87            $feed = new XML_Feed_Parser($content);
88        } catch (XML_Feed_Parser_Exception $e) {
89            $this->assertTrue(false);
90            return;
91        }
92        $this->assertEquals('correct description', $feed->getEntryByOffset(0)->description);
93    }
94}
95
96$suite = new PHPUnit_TestSuite('namespace_TestCase');
97$result = PHPUnit::run($suite, '123');
98echo $result->toString();
99
100?>
Note: See TracBrowser for help on using the repository browser.