+
+ $extractor = new phinde\HubUrlExtractor();
+ $extractor->setRequestTemplate(
+ new HTTP_Request2(null, null, ['adapter' => $mock])
+ );
+
+ $this->assertEquals(
+ [
+ 'hub' => 'https://hub.example.com/',
+ 'self' => 'http://example.com/feed',
+ ],
+ $extractor->getUrls('http://example.org/')
+ );
+ }
+
+ public function testGetUrlsRss2WebLinking()
+ {
+ $mock = new HTTP_Request2_Adapter_Mock();
+ //HEAD
+ $this->addResponse(
+ $mock,
+ "HTTP/1.0 200 OK\r\n"
+ . "Content-type: application/rss+xml\r\n"
+ . "\r\n",
+ 'http://example.org/'
+ );
+ //HEAD
+ $this->addResponse(
+ $mock,
+ "HTTP/1.0 200 OK\r\n"
+ . "Content-type: application/rss+xml\r\n"
+ . "\r\n"
+ . <<<HTM
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <link>http://www.example.com/main.html</link>
+ <atom:link rel="self" href="http://example.com/feed"/>
+ <atom:link rel="hub" href="https://hub.example.com/"/>
+ </channel>
+</rss>
+HTM,
+ 'http://example.org/'
+ );
+