From 2e7783d19db390f1edfb2dd4024bbadd0db9a5fc Mon Sep 17 00:00:00 2001 From: PJ Dietz Date: Wed, 29 Apr 2015 07:42:40 -0400 Subject: [PATCH] Message::getHeaderLine returns an empty string when the header is not set. --- src/Message/Message.php | 8 ++++---- test/tests/unit/Message/MessageTest.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Message/Message.php b/src/Message/Message.php index f26ad9d..753dcd1 100644 --- a/src/Message/Message.php +++ b/src/Message/Message.php @@ -158,19 +158,19 @@ abstract class Message implements MessageInterface * and supply your own delimiter when concatenating. * * If the header does not appear in the message, this method MUST return - * a null value. + * an empty string. * * @param string $name Case-insensitive header field name. - * @return string|null A string of values as provided for the given header + * @return string A string of values as provided for the given header * concatenated together using a comma. If the header does not appear in - * the message, this method MUST return a null value. + * the message, this method MUST return an empty string. */ public function getHeaderLine($name) { if (isset($this->headers[$name])) { return join(", ", $this->headers[$name]); } else { - return null; + return ""; } } diff --git a/test/tests/unit/Message/MessageTest.php b/test/tests/unit/Message/MessageTest.php index 7e94eaa..6e575d7 100644 --- a/test/tests/unit/Message/MessageTest.php +++ b/test/tests/unit/Message/MessageTest.php @@ -186,10 +186,10 @@ class MessageTest extends \PHPUnit_Framework_TestCase /** * @covers WellRESTed\Message\Message::getHeaderLine */ - public function testGetHeaderLineReturnsNullForUnsetHeader() + public function testGetHeaderLineReturnsEmptyStringForUnsetHeader() { $message = $this->getMockForAbstractClass('\WellRESTed\Message\Message'); - $this->assertNull($message->getHeaderLine("X-not-set")); + $this->assertSame("", $message->getHeaderLine("X-not-set")); } /**