From 34fb3ab1cbceb2e739578398748ded5524c46ad2 Mon Sep 17 00:00:00 2001 From: javalizard <> Date: Sat, 17 Apr 2010 04:36:46 +0000 Subject: Added Unit tests for insertBefore/After. Change code to expected behavior. --- framework/Collections/TList.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'framework/Collections/TList.php') diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index bef39648..cc0eab6d 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -252,7 +252,8 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl */ public function insertBefore($baseitem, $item) { - if(($index = $this->indexOf($baseitem)) == -1) return null; + if(($index = $this->indexOf($baseitem)) == -1) + throw new TInvalidDataValueException('list_item_inexistent'); $this->insertAt($index, $item); @@ -268,7 +269,8 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl */ public function insertAfter($baseitem, $item) { - if(($index = $this->indexOf($baseitem)) == -1) return null; + if(($index = $this->indexOf($baseitem)) == -1) + throw new TInvalidDataValueException('list_item_inexistent'); $this->insertAt($index + 1, $item); -- cgit v1.2.3