function AggregatorTestBase::getInvalidOpml

Same name and namespace in other branches
  1. 8.9.x core/modules/aggregator/src/Tests/AggregatorTestBase.php \Drupal\aggregator\Tests\AggregatorTestBase::getInvalidOpml()
  2. 8.9.x core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php \Drupal\Tests\aggregator\Functional\AggregatorTestBase::getInvalidOpml()

Creates an invalid OPML file.

Return value

string Path to invalid OPML file.

1 call to AggregatorTestBase::getInvalidOpml()
ImportOpmlTest::submitImportForm in core/modules/aggregator/tests/src/Functional/ImportOpmlTest.php
Submits form with invalid, empty, and valid OPML files.

File

core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php, line 319

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\Tests\aggregator\Functional

Code

public function getInvalidOpml() {
    $opml = <<<EOF
<opml>
  <invalid>
</opml>
EOF;
    $path = 'public://invalid-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.