public function add($key, $value) { if (!$this->_r) { $this->_d[$key] = $value; } else { throw new TInvalidOperationException('map_readonly', get_class($this)); } }
public function testCanNotAddWhenReadOnly() { $map = new TMap(array(), true); try { $map->add('key', 'value'); } catch (TInvalidOperationException $e) { return; } self::fail('An expected TInvalidOperationException was not raised'); }