lithium\tests\cases\data\collection\RecordSetTest::testCurrent PHP Метод

testCurrent() публичный Метод

public testCurrent ( )
    public function testCurrent()
    {
        $this->assertEqual($this->_records[0], $this->_recordSet->current()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->next()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->current()->to('array'));
        $this->assertEqual($this->_records[0], $this->_recordSet->rewind()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->next()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->current()->to('array'));
        $this->assertEqual($this->_records[0], $this->_recordSet->rewind()->to('array'));
        $this->assertEqual($this->_records[0], $this->_recordSet->current()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->next()->to('array'));
        $this->assertEqual($this->_records[0], $this->_recordSet->rewind()->to('array'));
        $this->assertEqual($this->_records[1], $this->_recordSet->next()->to('array'));
        $this->assertEqual($this->_records[2], $this->_recordSet->next()->to('array'));
        $result = $this->_objectRecordSet->current();
        $this->assertEqual($this->_objectRecordSet[1]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[1]->data, $result->data);
        $this->_objectRecordSet->next();
        $result = $this->_objectRecordSet->current();
        $this->assertEqual($this->_objectRecordSet[2]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[2]->data, $result->data);
        $result = $this->_objectRecordSet->rewind();
        $this->assertEqual($this->_objectRecordSet[1]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[1]->data, $result->data);
        $result = $this->_objectRecordSet->next();
        $this->assertEqual($this->_objectRecordSet[2]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[2]->data, $result->data);
        $this->_objectRecordSet->rewind();
        $result = $this->_objectRecordSet->current();
        $this->assertEqual($this->_objectRecordSet[1]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[1]->data, $result->data);
        $result = $this->_objectRecordSet->next();
        $this->assertEqual($this->_objectRecordSet[2]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[2]->data, $result->data);
        $this->_objectRecordSet->rewind();
        $result = $this->_objectRecordSet->next();
        $this->assertEqual($this->_objectRecordSet[2]->id, $result->id);
        $this->assertEqual($this->_objectRecordSet[2]->data, $result->data);
    }