Ejemplo n.º 1
0
 /**
  * Tests whether removeByKey() works as expected.
  *
  * @return void
  */
 public function testRemoveByKey()
 {
     $map = new NormalizingMap(null, null, array('foo' => 1, 'Bar' => 2, 'BAZ' => 3, 1 => 4, '1' => 5));
     $this->assertSame(array('foo' => 1, 'Bar' => 2, 'BAZ' => 3, 1 => 4, '1' => 5), $map->toArray());
     $map->removeByKey('FOO');
     $this->assertSame(array('foo' => 1, 'Bar' => 2, 'BAZ' => 3, 1 => 4, '1' => 5), $map->toArray());
     $map->removeByKey('foo');
     $this->assertSame(array('Bar' => 2, 'BAZ' => 3, 1 => 4, '1' => 5), $map->toArray());
     $map->removeByKey('1');
     $this->assertSame(array('Bar' => 2, 'BAZ' => 3), $map->toArray());
     $map = new NormalizingMap($this->getToLowerCaseCallback(), null, array('foo' => 1, 'Bar' => 2, 'BAZ' => 3, 1 => 4, '1' => 5));
     $this->assertSame(array('foo' => 1, 'bar' => 2, 'baz' => 3, 1 => 4, '1' => 5), $map->toArray());
     $map->removeByKey('FOO');
     $this->assertSame(array('bar' => 2, 'baz' => 3, '1' => 5), $map->toArray());
     $map->removeByKey('foo');
     $this->assertSame(array('bar' => 2, 'baz' => 3, 1 => 5), $map->toArray());
     $map->removeByKey('1');
     $this->assertSame(array('bar' => 2, 'baz' => 3), $map->toArray());
 }