From 56df3d3faa32bb92223b363945ce0b19761f040f Mon Sep 17 00:00:00 2001 From: tof <> Date: Wed, 13 Jun 2007 12:01:20 +0000 Subject: Implements THttpCookie, THttpCookieCollection, and THttpRequest unit tests --- tests/unit/Web/THttpCookieCollectionTest.php | 30 +++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'tests/unit/Web/THttpCookieCollectionTest.php') diff --git a/tests/unit/Web/THttpCookieCollectionTest.php b/tests/unit/Web/THttpCookieCollectionTest.php index 9c648e2b..ece8f275 100644 --- a/tests/unit/Web/THttpCookieCollectionTest.php +++ b/tests/unit/Web/THttpCookieCollectionTest.php @@ -9,23 +9,43 @@ Prado::using('System.Web.THttpRequest'); class THttpCookieCollectionTest extends PHPUnit_Framework_TestCase { public function testConstruct() { - throw new PHPUnit_Framework_IncompleteTestError(); + $coll=new THttpCookieCollection(); + self::assertType('THttpCookieCollection', $coll); } public function testInsertAt() { - throw new PHPUnit_Framework_IncompleteTestError(); + $coll=new THttpCookieCollection(); + $coll->insertAt(0, new THttpCookie('name','value')); + self::assertEquals('value',$coll->itemAt(0)->getValue()); + try { + $coll->insertAt(1, "bad parameter"); + self::fail ('Invalid data type exception not raised'); + } catch (TInvalidDataTypeException $e) {} } public function testRemoveAt() { - throw new PHPUnit_Framework_IncompleteTestError(); + $coll=new THttpCookieCollection(); + try { + $coll->removeAt(0); + self::fail('Invalid Value exception not raised'); + } catch (TInvalidDataValueException $e) {} + + $coll->insertAt(0, new THttpCookie('name','value')); + self::assertEquals('value',$coll->removeAt(0)->getValue()); } public function testItemAt() { - throw new PHPUnit_Framework_IncompleteTestError(); + $coll=new THttpCookieCollection(); + $coll->insertAt(0, new THttpCookie('name','value')); + self::assertEquals('value',$coll->itemAt(0)->getValue()); + self::assertEquals('value',$coll->itemAt('name')->getValue()); } public function testFindCookieByName() { - throw new PHPUnit_Framework_IncompleteTestError(); + $coll=new THttpCookieCollection(); + $coll->insertAt(0, new THttpCookie('name','value')); + self::assertEquals ('value', $coll->findCookieByName('name')->getValue()); + self::assertNull ($coll->findCookieByName('invalid')); } } ?> \ No newline at end of file -- cgit v1.2.3