function AggregatorTestBase::getEmptyOpml

Same name in this branch
  1. 8.9.x core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getEmptyOpml()
Same name in other branches
  1. 9 core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getEmptyOpml()

Creates a valid but empty OPML file.

Return value

string Path to empty OPML file.

File

core/modules/aggregator/src/Tests/AggregatorTestBase.php, line 325

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\aggregator\Tests

Code

public function getEmptyOpml() {
    $opml = <<<EOF
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
  <head></head>
  <body>
    <outline text="Sample text" />
    <outline text="Sample text" url="Sample URL" />
  </body>
</opml>
EOF;
    $path = 'public://empty-opml.xml';
    return \Drupal::service('file_system')->saveData($opml, $path);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.