Skip to content

Commit

Permalink
Fixes two failing Pubsubhubbub tests
Browse files Browse the repository at this point in the history
Fixes bug where Zend_Feed_Writer would render empty description elements if no description (or empty description) was set for an entry.


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20241 44c647ce-9c0f-0410-b52a-842ac1e357ba
  • Loading branch information
padraic committed Jan 12, 2010
1 parent 01476da commit b0d4d78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library/Zend/Feed/Pubsubhubbub/Model/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function setSubscription(array $data)
$data['created_time'] = $result->current()->created_time;
$now = new Zend_Date;
$data['last_modified'] = $now->get('yyyy-MM-dd HH:mm:ss');
$data['expiration_time'] = $now->add($data['lease_seconds'], Zend_Date::SECOND)
$data['expiration_time'] = $now->add($result->current()->lease_seconds, Zend_Date::SECOND)
->get('yyyy-MM-dd HH:mm:ss');
$this->_db->update(
$data,
Expand Down
3 changes: 3 additions & 0 deletions library/Zend/Feed/Writer/Renderer/Entry/Rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ protected function _setDescription(DOMDocument $dom, DOMElement $root)
return;
}
}
if (!$this->getDataContainer()->getDescription()) {
return;
}
$subtitle = $dom->createElement('description');
$root->appendChild($subtitle);
$text = $dom->createCDATASection($this->getDataContainer()->getDescription());
Expand Down
14 changes: 8 additions & 6 deletions tests/Zend/Feed/Pubsubhubbub/Subscriber/CallbackTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,17 @@ public function testRespondsToValidConfirmationWith200Response()
$rowdata = new stdClass;
$rowdata->id = 'verifytokenkey';
$rowdata->verify_token = hash('sha256', 'cba');
$t = time();
$rowdata->created_time = $t;
$t = new Zend_Date;
$rowdata->created_time = $t->get(Zend_Date::TIMESTAMP);
$rowdata->lease_seconds = 10000;
$this->_rowset->expects($this->any())
->method('current')
->will($this->returnValue($rowdata));

$this->_tableGateway->expects($this->once())
->method('update')
->with(
$this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')),
$this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))),
$this->equalTo('id = \'verifytokenkey\'')
);
$this->_adapter->expects($this->once())
Expand All @@ -282,16 +283,17 @@ public function testRespondsToValidConfirmationWithBodyContainingHubChallenge()
$rowdata = new stdClass;
$rowdata->id = 'verifytokenkey';
$rowdata->verify_token = hash('sha256', 'cba');
$t = time();
$rowdata->created_time = $t;
$t = new Zend_Date;
$rowdata->created_time = $t->get(Zend_Date::TIMESTAMP);
$rowdata->lease_seconds = 10000;
$this->_rowset->expects($this->any())
->method('current')
->will($this->returnValue($rowdata));

$this->_tableGateway->expects($this->once())
->method('update')
->with(
$this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t,'verified'=>'1')),
$this->equalTo(array('id'=>'verifytokenkey','verify_token'=>hash('sha256', 'cba'),'created_time'=>$t->get(Zend_Date::TIMESTAMP),'lease_seconds'=>10000,'subscription_state'=>'verified','last_modified'=>$t->get('yyyy-MM-dd HH:mm:ss'),'expiration_time'=>$t->add(10000,Zend_Date::SECOND)->get('yyyy-MM-dd HH:mm:ss'))),
$this->equalTo('id = \'verifytokenkey\'')
);
$this->_adapter->expects($this->once())
Expand Down

0 comments on commit b0d4d78

Please sign in to comment.