diff options
author | xue <> | 2006-01-31 00:01:49 +0000 |
---|---|---|
committer | xue <> | 2006-01-31 00:01:49 +0000 |
commit | 01bc363ac789cfb9d644ce82a949da5cd7e1c220 (patch) | |
tree | a059046856645d59cf0cb1badee83eb5c73671e9 /tests/UnitTests/framework/Collections/utMap.php | |
parent | 265b7e85766ba403ca0a8b58648dd091e483cf38 (diff) |
Modified TList and TMap implementation so that they can be more easily extended.
Diffstat (limited to 'tests/UnitTests/framework/Collections/utMap.php')
-rw-r--r-- | tests/UnitTests/framework/Collections/utMap.php | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/tests/UnitTests/framework/Collections/utMap.php b/tests/UnitTests/framework/Collections/utMap.php index 1f7a20ad..37818542 100644 --- a/tests/UnitTests/framework/Collections/utMap.php +++ b/tests/UnitTests/framework/Collections/utMap.php @@ -7,54 +7,6 @@ class MapItem public $data='data';
}
-class NewMap extends TMap
-{
- private $_canAddItem=true;
- private $_canRemoveItem=true;
- private $_itemAdded=false;
- private $_itemRemoved=false;
-
- protected function addedItem($key,$value)
- {
- $this->_itemAdded=true;
- }
-
- protected function removedItem($key,$value)
- {
- $this->_itemRemoved=true;
- }
-
- protected function canAddItem($key,$value)
- {
- return $this->_canAddItem;
- }
-
- protected function canRemoveItem($key,$value)
- {
- return $this->_canRemoveItem;
- }
-
- public function setCanAddItem($value)
- {
- $this->_canAddItem=$value;
- }
-
- public function setCanRemoveItem($value)
- {
- $this->_canRemoveItem=$value;
- }
-
- public function isItemAdded()
- {
- return $this->_itemAdded;
- }
-
- public function isItemRemoved()
- {
- return $this->_itemRemoved;
- }
-}
-
class utMap extends UnitTestCase
{
protected $map;
@@ -203,43 +155,6 @@ class utMap extends UnitTestCase $this->assertTrue(isset($this->map['key1']));
$this->assertFalse(isset($this->map['unknown key']));
}
-
- public function testDerivedClasses()
- {
- $newMap=new NewMap;
- $this->assertFalse($newMap->isItemAdded());
- $newMap->add('key','value');
- $this->assertTrue($newMap->isItemAdded());
- $newMap->add('key2','value2');
-
- $newMap->setCanAddItem(false);
- try
- {
- $newMap->add('new key','new value');
- $this->fail('no exception raised when adding an item that is disallowed');
- }
- catch(TInvalidOperationException $e)
- {
- $this->assertEqual(2,$newMap->getCount());
- $this->pass();
- }
-
- $this->assertFalse($newMap->isItemRemoved());
- $newMap->remove('key');
- $this->assertTrue($newMap->isItemRemoved());
-
- $newMap->setCanRemoveItem(false);
- try
- {
- $newMap->remove('key2');
- $this->fail('no exception raised when removing an item that is disallowed');
- }
- catch(TInvalidOperationException $e)
- {
- $this->assertEqual(1,$newMap->getCount());
- $this->pass();
- }
- }
}
?>
\ No newline at end of file |