You are here

public function FeedsHTTPRequestTestCase::testHTTPRequestFindFeeds in Feeds 7.2

Tests http_request_find_feeds().

File

tests/http_request.test, line 35
Tests for http_request.inc.

Class

FeedsHTTPRequestTestCase
Tests for the http library.

Code

public function testHTTPRequestFindFeeds() {
  $html = <<<EOF
<html>
  <head>
    <title>Welcome to Example.com</title>
    <link rel="stylesheet" type="text/css" media="screen, projection" href="/stuff.css" >
    <link rel="search"    title="Something" href="//example.com/search">
    <link rel="alternate" title="Something RSS" href="http://example.com/rss.xml" type="application/rss+xml">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
  </head>
  <body>
    This is a body.
  </body>
</html
EOF;
  $links = http_request_find_feeds($html);
  $this
    ->assertEqual(count($links), 1);
  $this
    ->assertEqual($links[0], 'http://example.com/rss.xml');

  // Test single quoted HTML.
  $links = http_request_find_feeds(str_replace('"', "'", $html));
  $this
    ->assertEqual(count($links), 1);
  $this
    ->assertEqual($links[0], 'http://example.com/rss.xml');
}