Selaa lähdekoodia

Fixes two failing Pubsubhubbub tests
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

padraic 16 vuotta sitten
vanhempi
commit
b0d4d7809b

+ 1 - 1
library/Zend/Feed/Pubsubhubbub/Model/Subscription.php

@@ -56,7 +56,7 @@ class Zend_Feed_Pubsubhubbub_Model_Subscription
             $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,

+ 3 - 0
library/Zend/Feed/Writer/Renderer/Entry/Rss.php

@@ -131,6 +131,9 @@ class Zend_Feed_Writer_Renderer_Entry_Rss
                 return;
             }
         }
+        if (!$this->getDataContainer()->getDescription()) {
+            return;
+        }
         $subtitle = $dom->createElement('description');
         $root->appendChild($subtitle);
         $text = $dom->createCDATASection($this->getDataContainer()->getDescription());

+ 8 - 6
tests/Zend/Feed/Pubsubhubbub/Subscriber/CallbackTest.php

@@ -252,8 +252,9 @@ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_T
         $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));
@@ -261,7 +262,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_T
         $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())
@@ -282,8 +283,9 @@ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_T
         $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));
@@ -291,7 +293,7 @@ class Zend_Feed_Pubsubhubbub_Subscriber_CallbackTest extends PHPUnit_Framework_T
         $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())