Changeset 1721

Show
Ignore:
Timestamp:
07/20/08 17:47:25 (2 months ago)
Author:
mikey
Message:

add net::stubbles::lang::stubArrayAccessor::getKeys()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework/trunk/src/main/php/net/stubbles/lang/stubArrayAccessor.php

    r1719 r1721  
    182182        return new ArrayIterator($this->data); 
    183183    } 
     184 
     185    /** 
     186     * returns a list of all keys of the wrapped array 
     187     * 
     188     * @return  array<int,scalar> 
     189     */ 
     190    public function getKeys() 
     191    { 
     192        return array_keys($this->data); 
     193    } 
    184194} 
    185195?> 
  • framework/trunk/src/test/php/net/stubbles/lang/stubArrayAccessorTestCase.php

    r1701 r1721  
    201201        ); 
    202202    } 
     203 
     204    /** 
     205     * keys of wrapped array should be returned 
     206     * 
     207     * @test 
     208     */ 
     209    public function getKeys() 
     210    { 
     211        $this->assertEquals(array('first', 'second', 'third'), 
     212                            $this->arrayAccessorAssociative->getKeys() 
     213        ); 
     214        $this->assertEquals(array(0, 1, 2), 
     215                            $this->arrayAccessorNumeric->getKeys() 
     216        ); 
     217        $this->assertEquals(array(0), 
     218                            $this->arrayAccessorOne->getKeys() 
     219        ); 
     220        $this->assertEquals(array(), 
     221                            $this->arrayAccessorEmpty->getKeys() 
     222        ); 
     223    } 
    203224} 
    204225?>