Просмотр исходного кода

ZF-11150
Zend_Feed
Fixed setCommentCount to accept zero as valid quantity of comments


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23909 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan 14 лет назад
Родитель
Сommit
29174ddd3a
2 измененных файлов с 11 добавлено и 1 удалено
  1. 1 1
      library/Zend/Feed/Writer/Entry.php
  2. 10 0
      tests/Zend/Feed/Writer/EntryTest.php

+ 1 - 1
library/Zend/Feed/Writer/Entry.php

@@ -295,7 +295,7 @@ class Zend_Feed_Writer_Entry
      */
     public function setCommentCount($count)
     {
-        if (empty($count) || !is_numeric($count) || (int) $count < 0) {
+        if ( !is_numeric($count) || (int) $count < 0) {
             require_once 'Zend/Feed/Exception.php';
             throw new Zend_Feed_Exception('Invalid parameter: "count" must be a non-empty integer number');
         }

+ 10 - 0
tests/Zend/Feed/Writer/EntryTest.php

@@ -519,6 +519,16 @@ class Zend_Feed_Writer_EntryTest extends PHPUnit_Framework_TestCase
         $entry->setCommentCount('10');
         $this->assertEquals(10, $entry->getCommentCount());
     }
+    
+    /**
+     * @group ZF-11150
+     */
+    public function testSetCommentCountAcceptsZero()
+    {
+        $entry = new Zend_Feed_Writer_Entry();
+        $entry->setCommentCount(0);
+        $this->assertEquals(0, $entry->getCommentCount());
+    }
 
     public function testSetCommentCountThrowsExceptionOnInvalidEmptyParameter()
     {