From 9e1c6c92c4d91eb7dad14a84f86a704da5325ba8 Mon Sep 17 00:00:00 2001 From: Ville Mattila Date: Fri, 8 Feb 2013 20:14:42 +0200 Subject: [PATCH] * Added two incomplete, but valid "Set-Cookie:" and "Set-Cookie: " headers to the test dataprovider * Modified behaviour of SetCookie::getFieldValue() in case of empty header --- src/Header/SetCookie.php | 2 +- test/Header/SetCookieTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Header/SetCookie.php b/src/Header/SetCookie.php index 38b591fa95..4c24fdc696 100644 --- a/src/Header/SetCookie.php +++ b/src/Header/SetCookie.php @@ -228,7 +228,7 @@ public function getFieldName() public function getFieldValue() { if ($this->getName() == '') { - throw new Exception\RuntimeException('A cookie name is required to generate a field value for this cookie'); + return ''; } $value = $this->getValue(); diff --git a/test/Header/SetCookieTest.php b/test/Header/SetCookieTest.php index 348f81374b..f062859525 100644 --- a/test/Header/SetCookieTest.php +++ b/test/Header/SetCookieTest.php @@ -334,7 +334,16 @@ public static function validCookieWithInfoProvider() ), 'myname=myvalue; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Domain=docs.foo.com; Path=/accounts; Secure; HttpOnly' ), + array( + 'Set-Cookie:', + array(), + '' + ), + array( + 'Set-Cookie: ', + array(), + '' + ), ); } - }