You are here

public function FeedsWebTestBase::generateOPML in Feeds 8.2

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.

File

lib/Drupal/feeds/Tests/FeedsWebTestBase.php, line 137
Common functionality for all Feeds tests.

Class

FeedsWebTestBase
Test basic Data API functionality.

Namespace

Drupal\feeds\Tests

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);
  $filename = file_default_scheme() . '://test-opml-' . $this
    ->randomName() . '.opml';
  $filename = file_unmanaged_save_data($output, $filename);
  return $filename;
}