set_registry() публичный Метод

public set_registry ( SimplePie_Registry $registry )
$registry SimplePie_Registry
Пример #1
0
 /**
  * @dataProvider firefoxtests
  */
 public function test_from_file($data)
 {
     $locator = new SimplePie_Locator($data, 0, null, false);
     $registry = new SimplePie_Registry();
     $registry->register('File', 'MockSimplePie_File');
     $locator->set_registry($registry);
     $expected = array();
     $document = new DOMDocument();
     $document->loadHTML($data->body);
     $xpath = new DOMXPath($document);
     foreach ($xpath->query('//link') as $element) {
         $expected[] = 'http://example.com' . $element->getAttribute('href');
     }
     //$expected = SimplePie_Misc::get_element('link', $data->body);
     $feed = $locator->find(SIMPLEPIE_LOCATOR_ALL, $all);
     $this->assertFalse($locator->is_feed($data), 'HTML document not be a feed itself');
     $this->assertInstanceOf('MockSimplePie_File', $feed);
     $success = array_filter($expected, array(get_class(), 'filter_success'));
     $found = array_map(array(get_class(), 'map_url_file'), $all);
     $this->assertEquals($success, $found);
 }
Пример #2
0
function check_feed($url)
{
    require_once dirname(__FILE__) . '/lib/simplepie_1.3.compiled.php';
    $file = new SimplePie_File($url);
    $test = new SimplePie_Locator($file);
    $test->set_registry(new SimplePie_Registry());
    if ($test->is_feed($file)) {
        return true;
    } else {
        return false;
    }
}