summaryrefslogtreecommitdiff
path: root/tests/unit/Web/THttpCookieCollectionTest.php
diff options
context:
space:
mode:
authortof <>2007-06-13 12:01:20 +0000
committertof <>2007-06-13 12:01:20 +0000
commit56df3d3faa32bb92223b363945ce0b19761f040f (patch)
tree17742fb863a02dab33c003636941354df4062ca0 /tests/unit/Web/THttpCookieCollectionTest.php
parent643386f289d94e6c4484e0c9dbabc22e5a373b1c (diff)
Implements THttpCookie, THttpCookieCollection, and THttpRequest unit tests
Diffstat (limited to 'tests/unit/Web/THttpCookieCollectionTest.php')
-rw-r--r--tests/unit/Web/THttpCookieCollectionTest.php30
1 files changed, 25 insertions, 5 deletions
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