function AddFeedTest::urlToRSSLinkPattern
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::urlToRSSLinkPattern()
- 8.9.x core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::urlToRSSLinkPattern()
- 11.x core/modules/system/tests/src/Kernel/Common/AddFeedTest.php \Drupal\Tests\system\Kernel\Common\AddFeedTest::urlToRSSLinkPattern()
Creates a pattern representing the RSS feed in the page.
1 call to AddFeedTest::urlToRSSLinkPattern()
- AddFeedTest::testBasicFeedAddNoTitle in core/
modules/ system/ tests/ src/ Kernel/ Common/ AddFeedTest.php - Tests attaching feeds with paths, URLs, and titles.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Common/ AddFeedTest.php, line 80
Class
- AddFeedTest
- Make sure that attaching feeds works correctly with various constructs.
Namespace
Drupal\Tests\system\Kernel\CommonCode
public function urlToRSSLinkPattern($url, $title = '') {
// Escape any regular expression characters in the URL ('?' is the worst).
$url = preg_replace('/([+?.*])/', '[$0]', $url);
$generated_pattern = '%<link +href="' . $url . '" +rel="alternate" +title="' . $title . '" +type="application/rss.xml" */>%';
return $generated_pattern;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.