コード例 #1
0
 /**
  * Tests whether set() works as expected.
  *
  * @return void
  */
 public function testSet()
 {
     $map = new OrderedMap();
     $map->set('foo', 'bar');
     $this->assertTrue($map->containsKey('foo'));
     $this->assertTrue($map->containsValue('bar'));
     $this->assertSame('bar', $map->get('foo'));
     $map->set('foo', 'baz');
     $this->assertTrue($map->containsKey('foo'));
     $this->assertTrue($map->containsValue('baz'));
     $this->assertSame('baz', $map->get('foo'));
     $map->set(0, 42);
     $this->assertTrue($map->containsKey(0));
     $this->assertTrue($map->containsValue(42));
     $this->assertSame(42, $map->get(0));
     $map->set(0, 'foo');
     $this->assertSame('foo', $map->get(0));
 }