You are here

public function FeedsWebTestCase::generateOPML in Feeds 6

Same name and namespace in other branches
  1. 7.2 tests/feeds.test \FeedsWebTestCase::generateOPML()
  2. 7 tests/feeds.test.inc \FeedsWebTestCase::generateOPML()

Generate an OPML test feed.

The purpose of this function is to create a dynamic OPML feed that points to feeds included in this test.

1 call to FeedsWebTestCase::generateOPML()
FeedsExamplesOPMLTestCase::test in feeds_news/feeds_news.test
Run tests.

File

tests/feeds.test, line 81
Common functionality for all Feeds tests.

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function generateOPML() {
  $path = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/';
  $output = '<?xml version="1.0" encoding="utf-8"?>
<opml version="1.1">
<head>
    <title>Feeds test OPML</title>
    <dateCreated>Fri, 16 Oct 2009 02:53:17 GMT</dateCreated>
    <ownerName></ownerName>
</head>
<body>
  <outline text="Feeds test group" >
       <outline title="Development Seed - Technological Solutions for Progressive Organizations" text="" xmlUrl="' . $path . 'developmentseed.rss2" type="rss" />
       <outline title="Magyar Nemzet Online - H\'rek" text="" xmlUrl="' . $path . 'feed_without_guid.rss2" type="rss" />
       <outline title="Drupal planet" text="" type="rss" xmlUrl="' . $path . 'drupalplanet.rss2" />
    </outline>
</body>
</opml>';

  // UTF 8 encode output string and write it to disk
  $output = utf8_encode($output);
  $file = $this
    ->absolute() . '/' . file_directory_path() . '/test-opml-' . $this
    ->randomName() . '.opml';
  $handle = fopen($file, 'w');
  fwrite($handle, $output);
  fclose($handle);
  return $file;
}