public function HttpHelpersTest::testFindLinkXml in Feeds 8.3
@covers ::findRelationFromXml
File
- tests/
src/ Unit/ Component/ HttpHelpersTest.php, line 26
Class
- HttpHelpersTest
- @coversDefaultClass \Drupal\feeds\Component\HttpHelpers @group feeds
Namespace
Drupal\Tests\feeds\Unit\ComponentCode
public function testFindLinkXml() {
$xml = '<feed xmlns="http://www.w3.org/2005/Atom">
<title>Blah blah blah</title>
<link href="http://example.com/feed" rel="self" type="application/atom+xml"/>
<link href="http://example.com" rel="alternate" type="text/html"/>
<link rel="hub" href="http://example.com/hub" />
<updated>2015-02-03T13:08:02+01:00</updated>
<id>http://blog.superfeedr.com/</id></feed>';
$this
->assertSame('http://example.com/hub', HttpHelpers::findRelationFromXml($xml, 'hub'));
$xml = '<?xml version="1.0"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link rel="hub" href="http://example.com/hub"/>
</channel></rss>';
$this
->assertSame('http://example.com/hub', HttpHelpers::findRelationFromXml($xml, 'hub'));
$this
->assertSame(FALSE, HttpHelpers::findRelationFromXml('', 'hub'));
$this
->assertSame(FALSE, HttpHelpers::findRelationFromXml(' ', 'hub'));
}