/usr/share/php/tests/Horde_Feed/Horde/Feed/IteratorTest.php is in php-horde-feed 2.0.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | <?php
/**
* @category Horde
* @package Feed
* @subpackage UnitTests
*/
class Horde_Feed_IteratorTest extends PHPUnit_Framework_TestCase {
private $feed;
private $nsfeed;
public function setUp()
{
$this->feed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeed.xml');
$this->nsfeed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeedNamespaced.xml');
}
public function testRewind()
{
$times = 0;
foreach ($this->feed as $f) {
++$times;
}
$times2 = 0;
foreach ($this->feed as $f) {
++$times2;
}
$this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through');
$times = 0;
foreach ($this->nsfeed as $f) {
++$times;
}
$times2 = 0;
foreach ($this->nsfeed as $f) {
++$times2;
}
$this->assertEquals($times, $times2, 'Feed should have the same number of iterations multiple times through');
}
public function testCurrent()
{
foreach ($this->feed as $f) {
$this->assertTrue($f instanceof Horde_Feed_Entry_Atom, 'Each feed entry should be an instance of Horde_Feed_Entry_Atom');
break;
}
foreach ($this->nsfeed as $f) {
$this->assertTrue($f instanceof Horde_Feed_Entry_Atom, 'Each feed entry should be an instance of Horde_Feed_Entry_Atom');
break;
}
}
public function testKey()
{
$keys = array();
foreach ($this->feed as $k => $f) {
$keys[] = $k;
}
$this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1');
$keys = array();
foreach ($this->nsfeed as $k => $f) {
$keys[] = $k;
}
$this->assertEquals($keys, array(0, 1), 'Feed should have keys 0 and 1');
}
public function testNext()
{
$last = null;
foreach ($this->feed as $current) {
$this->assertFalse($last === $current, 'Iteration should produce a new object each entry');
$last = $current;
}
$last = null;
foreach ($this->nsfeed as $current) {
$this->assertFalse($last === $current, 'Iteration should produce a new object each entry');
$last = $current;
}
}
}
|