You are here

protected function CommonSyndicationParserTestCase::_testAtomEntriesWithoutBaseUrl in Feeds 7.2

Tests if the base url is prepended for entries without base url.

For example, the url in the following entry should be parsed as 'http://www.example.com/node/123' and not as 'node/123'.


<entry>
  <link href="node/123"/>
</entry>
1 call to CommonSyndicationParserTestCase::_testAtomEntriesWithoutBaseUrl()
CommonSyndicationParserTestCase::test in tests/common_syndication_parser.test
Dispatch tests, only use one entry point method testX to save time.

File

tests/common_syndication_parser.test, line 113
Tests for the common syndication parser.

Class

CommonSyndicationParserTestCase
Test cases for common syndication parser library.

Code

protected function _testAtomEntriesWithoutBaseUrl() {
  $string = $this
    ->readFeed('entries-without-base-url.atom');
  $feed = common_syndication_parser_parse($string);

  // Assert that all items got the base url assigned.
  $expected = array(
    'http://www.example.com/node/1281496#comment-11669575',
    'http://www.example.com/node/1281496#comment-10080648',
    'http://www.example.com/node/1281496#comment-10062564',
  );
  foreach ($feed['items'] as $key => $item) {
    $this
      ->assertEqual($expected[$key], $item['url']);
  }
}