lithium\tests\cases\data\collection\DocumentSetTest::testOffsetGetBackwards PHP Method

testOffsetGetBackwards() public method

    public function testOffsetGetBackwards()
    {
        $result = new MockResult(array('data' => array(array('_id' => '4c8f86167675abfabdbf0300', 'title' => 'bar'), array('_id' => '5c8f86167675abfabdbf0301', 'title' => 'foo'), array('_id' => '6c8f86167675abfabdbf0302', 'title' => 'dib'))));
        $doc = new DocumentSet(array('model' => $this->_model, 'result' => $result));
        $expected = array('_id' => '6c8f86167675abfabdbf0302', 'title' => 'dib');
        $this->assertEqual($expected, $doc['6c8f86167675abfabdbf0302']->data());
        $expected = array('_id' => '5c8f86167675abfabdbf0301', 'title' => 'foo');
        $this->assertEqual($expected, $doc['5c8f86167675abfabdbf0301']->data());
        $expected = array('_id' => '4c8f86167675abfabdbf0300', 'title' => 'bar');
        $this->assertEqual($expected, $doc['4c8f86167675abfabdbf0300']->data());
    }