lithium\tests\cases\util\CollectionTest::testObjectCasting PHP Method

testObjectCasting() public method

public testObjectCasting ( )
    public function testObjectCasting()
    {
        $collection = new Collection(array('data' => array_fill(0, 10, new MockCollectionObject())));
        $result = $collection->to('array');
        $expected = array_fill(0, 10, array(1 => 2, 2 => 3));
        $this->assertEqual($expected, $result);
        $collection = new Collection(array('data' => array_fill(0, 10, new MockCollectionMarker())));
        $result = $collection->to('array');
        $expected = array_fill(0, 10, array('marker' => false, 'data' => 'foo'));
        $this->assertEqual($expected, $result);
        $collection = new Collection(array('data' => array_fill(0, 10, new MockCollectionStringCast())));
        $result = $collection->to('array');
        $expected = array_fill(0, 10, json_encode(array(1 => 2, 2 => 3)));
        $this->assertEqual($expected, $result);
    }