Example #1
0
 public function testIsOdd()
 {
     $col = new Collection();
     $this->assertFalse($col->isOdd(), 'isOdd() returns false on an empty collection');
     $data = array('bar1', 'bar2', 'bar3');
     $col = new Collection();
     $col->setData($data);
     foreach ($col as $key => $value) {
         $this->assertEquals((bool) ($key % 2), $col->isOdd(), 'isOdd() returns true only when the key is odd');
     }
 }