Exemplo n.º 1
0
 public function testNesting()
 {
     $original = array('a' => 1, 'b' => 2, 'c' => 3);
     $expected = array('a' => 2, 'b' => 4, 'c' => 6);
     $instanceFirst = ArrayMap::create($original);
     $instanceSecond = ArrayMap::create($instanceFirst);
     $instanceThird = ArrayMap::create($instanceSecond);
     $instanceThird->map(function ($value, $key) {
         return array($key => $value * 2);
     });
     $this->assertEquals($expected, $instanceFirst->getArray());
 }
Exemplo n.º 2
0
 /**
  * @return ArrayMap
  */
 public function getMap()
 {
     if (!$this->map) {
         $this->map = ArrayMap::create($this);
     }
     return $this->map;
 }
Exemplo n.º 3
0
 public function testMap()
 {
     $instance = new ArrayAccess();
     $this->assertInstanceOf(ArrayMap::className(), $instance->getMap());
 }