summaryrefslogtreecommitdiff
path: root/tests/unit/Web/THttpCookieCollectionTest.php
diff options
context:
space:
mode:
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