1<?php
2require_once 'PEAR/Config.php';
3require_once 'XML/Feed/Parser.php';
4require_once 'PHPUnit/Framework/TestCase.php';
5
6abstract class XML_Feed_Parser_TestCase extends PHPUnit_Framework_TestCase {
7
8    protected $backupGlobals = FALSE;
9
10    static function getSampleDir() {
11        $config = new PEAR_Config;
12        return dirname(__FILE__) . '/../samples';
13        // return $config->get('data_dir') . '/XML_Feed_Parser/samples';
14    }
15}
16
17abstract class XML_Feed_Parser_Converted_TestCase extends XML_Feed_Parser_TestCase {
18
19    function setup() {
20        $this->fp_test_dir = XML_Feed_Parser_TestCase::getSampleDir() .
21            DIRECTORY_SEPARATOR . 'feedparsertests';
22
23        if (! is_dir($this->fp_test_dir)) {
24            $this->markTestSkipped('Feed parser tests (http://code.google.com/p/feedparser/downloads/list) must be unpacked into the folder ' .
25                $this->fp_test_dir);
26        }
27    }
28
29    /**
30     * The python tests expect lowercase strings like 'rss20'
31     * Our (stable) API returns strings like "RSS 2.0"
32     */
33    protected function assertVersionMostlyCorrect($expected, $actual, $message = '') {
34        $mostly_actual = str_replace(array(" ","."), "", strtolower($actual));
35        $this->assertEquals($expected, $mostly_actual, $message);
36    }
37}
38?>
39