Selaa lähdekoodia

Zend_Feed_Abstract now implements Countable interface - fixes ZF-3848

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@18292 44c647ce-9c0f-0410-b52a-842ac1e357ba
padraic 16 vuotta sitten
vanhempi
commit
945480ff7d
2 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. 1 1
      library/Zend/Feed/Abstract.php
  2. 9 0
      tests/Zend/Feed/CountTest.php

+ 1 - 1
library/Zend/Feed/Abstract.php

@@ -40,7 +40,7 @@ require_once 'Zend/Feed/Element.php';
  * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
-abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator
+abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator, Countable
 {
     /**
      * Current index on the collection of feed entries for the

+ 9 - 0
tests/Zend/Feed/CountTest.php

@@ -47,4 +47,13 @@ class Zend_Feed_CountTest extends PHPUnit_Framework_TestCase
         $this->assertEquals($f->count(), 2, 'Feed count should be 2');
     }
 
+    /**
+    * ZF-3848
+    */
+    public function testCountableInterface()
+    {
+        $f = Zend_Feed::importFile(dirname(__FILE__) . '/_files/TestAtomFeed.xml');
+        $this->assertEquals(count($f), 2, 'Feed count should be 2');
+    }
+
 }