Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into 2574
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/PubSubHubbub/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ protected function _doRequest($mode)
}
$client->setUri($url);
$client->setRawBody($this->_getRequestParameters($url, $mode));
$response = $client->getResponse();
$response = $client->send();
if ($response->getStatusCode() !== 204
&& $response->getStatusCode() !== 202
) {
Expand Down
2 changes: 1 addition & 1 deletion src/PubSubHubbub/Subscriber/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Callback extends PubSubHubbub\AbstractCallback
* Holds a manually set subscription key (i.e. identifies a unique
* subscription) which is typical when it is not passed in the query string
* but is part of the Callback URL path, requiring manual retrieval e.g.
* using a route and the Zend_Controller_Action::_getParam() method.
* using a route and the \Zend\Mvc\Router\RouteMatch::getParam() method.
*
* @var string
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Reader/Extension/Syndication/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ public function getUpdateFrequencyAsTicks()
$ticks = 1;

switch ($period) {
//intentional fall through
case 'yearly':
$ticks *= 52; //TODO: fix generalisation, how?
// no break
case 'weekly':
$ticks *= 7;
// no break
case 'daily':
$ticks *= 24;
// no break
case 'hourly':
$ticks *= 3600;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/FeedSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function canonicalizePath($path)
}

/**
* Supports lazy loading of feeds using Zend_Feed_Reader::import() but
* Supports lazy loading of feeds using Reader::import() but
* delegates any other operations to the parent class.
*
* @param string $offset
Expand Down
14 changes: 8 additions & 6 deletions src/Writer/Extension/Atom/Renderer/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,14 @@ protected function _setFeedLinks(DOMDocument $dom, DOMElement $root)
return;
}
foreach ($flinks as $type => $href) {
$mime = 'application/' . strtolower($type) . '+xml';
$flink = $dom->createElement('atom:link');
$root->appendChild($flink);
$flink->setAttribute('rel', 'self');
$flink->setAttribute('type', $mime);
$flink->setAttribute('href', $href);
if (strtolower($type) == $this->getType()) { // issue 2605
$mime = 'application/' . strtolower($type) . '+xml';
$flink = $dom->createElement('atom:link');
$root->appendChild($flink);
$flink->setAttribute('rel', 'self');
$flink->setAttribute('type', $mime);
$flink->setAttribute('href', $href);
}
}
$this->called = true;
}
Expand Down
15 changes: 15 additions & 0 deletions test/Writer/Renderer/Feed/RssTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,21 @@ public function testFeedLinkToHtmlVersionOfFeedIfMissingThrowsException()
$rssFeed->render();
}

/**
* @group Issue2605
*/
public function testFeedIncludesLinkToXmlRssWhereRssAndAtomLinksAreProvided()
{
$this->validWriter->setFeedLink('http://www.example.com/rss', 'rss');
$this->validWriter->setFeedLink('http://www.example.com/atom', 'atom');
$rssFeed = new Renderer\Feed\Rss($this->validWriter);
$rssFeed->render();
$feed = Reader\Reader::importString($rssFeed->saveXml());
$this->assertEquals('http://www.example.com/rss', $feed->getFeedLink());
$xpath = new \DOMXPath($feed->getDomDocument());
$this->assertEquals(1, $xpath->evaluate('/rss/channel/atom:link[@rel="self"]')->length);
}

public function testFeedIncludesLinkToXmlRssWhereTheFeedWillBeAvailable()
{
$this->validWriter->setFeedLink('http://www.example.com/rss', 'rss');
Expand Down

0 comments on commit bb17ed2

Please sign in to comment.