public function testIteratorInterface() { $this->assertSame(array('key1' => '', 'key2' => '', 'key3' => ''), $this->_model->current()); $this->assertSame(-1, $this->_model->key()); $this->assertFalse($this->_model->valid()); $this->_model->expects($this->exactly(4))->method('_getNextRow')->will($this->onConsecutiveCalls(array(1, 2, 3), array(4, 5), array(6, 7, 8), false)); $data = array(); foreach ($this->_model as $key => $value) { $data[$key] = $value; } $this->assertSame(array(array('key1' => 1, 'key2' => 2, 'key3' => 3), array('key1' => 4, 'key2' => 5, 'key3' => ''), array('key1' => 6, 'key2' => 7, 'key3' => 8)), $data); }