diff options
author | xue <> | 2005-12-17 03:40:49 +0000 |
---|---|---|
committer | xue <> | 2005-12-17 03:40:49 +0000 |
commit | 73512adcb5ed2dca47a03c5e42ec9ebf0a1d9a94 (patch) | |
tree | 1543feaed886cc11430df70aad20611904585351 | |
parent | b9b2f490cf1f5a4878d11f97c0bfbd2d13fdf929 (diff) |
Changed TList::addAt to TList::insert
-rw-r--r-- | framework/Collections/TList.php | 6 | ||||
-rw-r--r-- | framework/TComponent.php | 4 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateControl.php | 2 | ||||
-rw-r--r-- | tests/UnitTests/framework/Collections/utList.php | 6 | ||||
-rw-r--r-- | tests/UnitTests/framework/utComponent.php | 20 |
5 files changed, 19 insertions, 19 deletions
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index d57e0f62..b9fbd589 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -16,7 +16,7 @@ * TList implements an integer-indexed collection class.
*
* You can access, append, insert, remove an item by using
- * {@link itemAt}, {@link add}, {@link addAt}, {@link remove}, and {@link removeAt}.
+ * {@link itemAt}, {@link add}, {@link insert}, {@link remove}, and {@link removeAt}.
* To get the number of the items in the list, use {@link getCount}.
* TList can also be used like a regular array as follows,
* <code>
@@ -123,7 +123,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * @throws TInvalidDataValueException If the index specified exceeds the bound
* @throws TInvalidOperationException If the item is not allowed to be added
*/
- public function addAt($index,$item)
+ public function insert($index,$item)
{
if($this->canAddItem($item))
{
@@ -307,7 +307,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess else
{
$this->removeAt($offset);
- $this->addAt($offset,$item);
+ $this->insert($offset,$item);
}
}
diff --git a/framework/TComponent.php b/framework/TComponent.php index c1b483c0..1a4dfe6e 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -300,12 +300,12 @@ class TComponent * getting and setting properties, e.g.,
* <code>
* $component->Click[]=array($object,'buttonClicked');
- * $component->Click->addAt(0,array($object,'buttonClicked'));
+ * $component->Click->insert(0,array($object,'buttonClicked'));
* </code>
* which are equivalent to the following
* <code>
* $component->getEventHandlers('Click')->add(array($object,'buttonClicked'));
- * $component->getEventHandlers('Click')->addAt(0,array($object,'buttonClicked'));
+ * $component->getEventHandlers('Click')->insert(0,array($object,'buttonClicked'));
* </code>
*
* @param string the event name
diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php index e1a2d248..dc4bc567 100644 --- a/framework/Web/UI/TTemplateControl.php +++ b/framework/Web/UI/TTemplateControl.php @@ -173,7 +173,7 @@ class TTemplateControl extends TControl implements INamingContainer if(isset($this->_placeholders[$id]))
{
list($parent,$loc)=$this->_placeholders[$id];
- $parent->getControls()->addAt($loc,$content);
+ $parent->getControls()->insert($loc,$content);
}
}
diff --git a/tests/UnitTests/framework/Collections/utList.php b/tests/UnitTests/framework/Collections/utList.php index a7b81f0a..056f38b1 100644 --- a/tests/UnitTests/framework/Collections/utList.php +++ b/tests/UnitTests/framework/Collections/utList.php @@ -101,16 +101,16 @@ class utList extends UnitTestCase }
- public function testAddAt()
+ public function testInsert()
{
- $this->list->addAt(0,$this->item3);
+ $this->list->insert(0,$this->item3);
$this->assertEqual(3,$this->list->getCount());
$this->assertEqual(2,$this->list->indexOf($this->item2));
$this->assertEqual(0,$this->list->indexOf($this->item3));
$this->assertEqual(1,$this->list->indexOf($this->item1));
try
{
- $this->list->addAt(4,$this->item3);
+ $this->list->insert(4,$this->item3);
$this->fail('exception not raised when adding item at an out-of-range index');
}
catch(TInvalidDataValueException $e)
diff --git a/tests/UnitTests/framework/utComponent.php b/tests/UnitTests/framework/utComponent.php index 3f57a863..32aa9ff3 100644 --- a/tests/UnitTests/framework/utComponent.php +++ b/tests/UnitTests/framework/utComponent.php @@ -171,7 +171,7 @@ class utComponent extends UnitTestCase $this->assertTrue($this->component->getEventHandlers('MyEvent')->getCount()===3);
$this->component->MyEvent[0]='foo4';
$this->assertTrue($this->component->getEventHandlers('MyEvent')->getCount()===3);
- $this->component->getEventHandlers('MyEvent')->addAt(0,'foo5');
+ $this->component->getEventHandlers('MyEvent')->insert(0,'foo5');
$this->assertTrue($this->component->MyEvent->Count===4 && $this->component->MyEvent[0]==='foo5');
$this->component->MyEvent='foo6';
$this->assertTrue($this->component->MyEvent->Count===5 && $this->component->MyEvent[4]==='foo6');*/
@@ -219,8 +219,8 @@ class utComponent extends UnitTestCase $this->pass();
}
}
-
-
+
+
/**
* Tests the TPropertyValue::ensureBoolean function
*/
@@ -236,7 +236,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureBoolean("0"), false);
$this->assertEqual(TPropertyValue::ensureBoolean(array()), false);
$this->assertEqual(TPropertyValue::ensureBoolean(null), false);
-
+
$this->assertEqual(TPropertyValue::ensureBoolean('true'), true);
$this->assertEqual(TPropertyValue::ensureBoolean('True'), true);
$this->assertEqual(TPropertyValue::ensureBoolean(1), true);
@@ -244,7 +244,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureBoolean("-1"), true);
$this->assertEqual(TPropertyValue::ensureBoolean(array("foboar")), true);
}
-
+
/**
* Tests the TPropertyValue::ensureString function
*/
@@ -255,7 +255,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureString(false), "false");
$this->assertEqual(TPropertyValue::ensureString(array("foo","bar")), (string)array("foo","bar"));
}
-
+
/**
* Tests the TPropertyValue::ensureInteger function
*/
@@ -265,7 +265,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureInteger("123"), 123);
$this->assertEqual(TPropertyValue::ensureInteger(""), 0);
}
-
+
/**
* Tests the TPropertyValue::ensureFloat function
*/
@@ -275,7 +275,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureFloat("123.123"), 123.123);
$this->assertEqual(TPropertyValue::ensureFloat(""), 0.0);
}
-
+
/**
* Tests the TPropertyValue::ensureArray function
*/
@@ -286,7 +286,7 @@ class utComponent extends UnitTestCase $this->assertEqual(TPropertyValue::ensureArray("(1,2,3)"), array(1,2,3));
$this->assertEqual(TPropertyValue::ensureArray(""), array());
}
-
+
/**
* Tests the TPropertyValue::ensureObject function
*/
@@ -294,7 +294,7 @@ class utComponent extends UnitTestCase {
$this->assertEqual(TPropertyValue::ensureObject($this->component), $this->component);
}
-
+
/**
* Tests the TPropertyValue::ensureEnum function
*/
|