function setup()
 {
     $this->fp_test_dir = XML_Feed_Parser_TestCase::getSampleDir() . DIRECTORY_SEPARATOR . 'feedparsertests';
     if (!is_dir($this->fp_test_dir)) {
         $this->markTestSkipped('Feed parser tests (http://code.google.com/p/feedparser/downloads/list) must be unpacked into the folder ' . $this->fp_test_dir);
     }
 }
 function setUp()
 {
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'hoder.xml');
     $this->feed = new XML_Feed_Parser($this->file);
     $this->entry = $this->feed->getEntryByOffset(0);
 }
 function setup()
 {
     $this->fp_test_dir = XML_Feed_Parser_TestCase::getSampleDir() . DIRECTORY_SEPARATOR . 'feedparsertests';
     if (!is_dir($fp_test_dir)) {
         throw new Exception('Feed parser tests must be unpacked into the folder ' . $this->fp_test_dir);
     }
 }
示例#4
0
 function __construct($name)
 {
     $this->PHPUnit_TestCase($name);
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->feed = new XML_Feed_Parser(file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'atom10-entryonly.xml'));
     $this->entry = $this->feed->getEntryByOffset(0);
 }
 function setUp()
 {
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "rss092-sample.xml");
     $this->feed = new XML_Feed_Parser($this->file, false, true);
     $this->entry = $this->feed->getEntryByOffset(0);
 }
示例#6
0
 function __construct($name)
 {
     $this->PHPUnit_TestCase($name);
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "sixapart-jp.xml");
     $this->feed = new XML_Feed_Parser($this->file);
     $this->entry = $this->feed->getEntryByOffset(0);
 }
 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]);
 }
 /**
  * Try to work with this ill-formed feed. If the tidy extension is not installed,
  * it expects parsing to fail. If tidy is installed and parsing fails, the test
  * fails. If tidy is installed and it parses, then the test passes.
  */
 function test_Tidy()
 {
     if (!extension_loaded('tidy')) {
         $this->markTestSkipped("You need the tidy extension installed to run this test");
     }
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml");
     $feed = new XML_Feed_Parser($file, false, true, true);
     $entry = $feed->getEntryByOffset(0);
     $this->assertEquals($entry->author, 'Example author');
 }
 function test_Base()
 {
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "xmlbase.xml");
     try {
         $feed = new XML_Feed_Parser($file, false, true, true);
     } catch (XML_Feed_Parser_Exception $e) {
         $this->assertTrue(false);
     }
     $entry = $feed->getEntryByOffset(0);
     $this->assertEquals($entry->link, 'http://www.tbray.org/ongoing/When/200x/2006/02/17/FSS');
 }
示例#10
0
 /**
  * Try to work with this ill-formed feed. If the tidy extension is not installed,
  * it expects parsing to fail. If tidy is installed and parsing fails, the test
  * fails. If tidy is installed and it parses, then the test passes.
  */
 function test_Tidy()
 {
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml");
     try {
         $feed = new XML_Feed_Parser($file, false, true, true);
     } catch (XML_Feed_Parser_Exception $e) {
         if (extension_loaded('tidy')) {
             $this->assertTrue(false);
         } else {
             $this->assertTrue(true);
         }
         return;
     }
     $entry = $feed->getEntryByOffset(0);
     $this->assertEquals($entry->author, 'Example author');
 }
 function setUp()
 {
     $this->sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
 }
 function __construct()
 {
     $this->sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->files = array('atom10-example1.xml', 'grwifi-atom.xml', 'technorati.feed', 'delicious.feed', 'rss2sample.xml', 'atom10-example2.xml', 'rss10-example1.xml', 'rss10-example2.xml');
 }
 function test_imageNodeAtDifferentLevels()
 {
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $value = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "rss2sample.xml");
     $parsed = new XML_Feed_Parser($value);
     $this->assertEquals(false, $parsed->image);
 }
示例#14
0
 function __construct($name)
 {
     $this->PHPUnit_TestCase($name);
     $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
     $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'grwifi-atom.xml');
     $this->parser = new XML_Feed_Parser($this->file);
     $this->entry = $this->parser->getEntryByOffset(0);
 }