Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Add new tests
Browse files Browse the repository at this point in the history
Test correct handling of accept headers with trailing semicolon and with semicolon without equal sign
  • Loading branch information
theboolean committed May 19, 2016
1 parent b3b51cb commit cd52116
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Header/AcceptEncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ public function testAcceptEncodingGetFieldValueReturnsProperValue()
$acceptEncodingHeader = AcceptEncoding::fromString('Accept-Encoding: xxx');
$this->assertEquals('xxx', $acceptEncodingHeader->getFieldValue());
}

public function testAcceptEncodingGetFieldValueReturnsProperValueWithTrailingSemicolon()
{
$acceptEncodingHeader = AcceptEncoding::fromString('Accept-Encoding: xxx;');
$this->assertEquals('xxx', $acceptEncodingHeader->getFieldValue());
}

public function testAcceptEncodingGetFieldValueReturnsProperValueWithSemicolonWithoutEqualSign()
{
$acceptEncodingHeader = AcceptEncoding::fromString('Accept-Encoding: xxx;yyy');
$this->assertEquals('xxx;yyy', $acceptEncodingHeader->getFieldValue());
}

public function testAcceptEncodingToStringReturnsHeaderFormattedString()
{
Expand Down
12 changes: 12 additions & 0 deletions test/Header/AcceptLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ public function testAcceptLanguageGetFieldValueReturnsProperValue()
$this->assertEquals('xxx', $acceptLanguageHeader->getFieldValue());
}

public function testAcceptLanguageGetFieldValueReturnsProperValueWithTrailingSemicolon()
{
$acceptLanguageHeader = AcceptLanguage::fromString('Accept-Language: xxx;');
$this->assertEquals('xxx', $acceptLanguageHeader->getFieldValue());
}

public function testAcceptLanguageGetFieldValueReturnsProperValueWithSemicolonWithoutEqualSign()
{
$acceptLanguageHeader = AcceptLanguage::fromString('Accept-Language: xxx;yyy');
$this->assertEquals('xxx;yyy', $acceptLanguageHeader->getFieldValue());
}

public function testAcceptLanguageToStringReturnsHeaderFormattedString()
{
$acceptLanguageHeader = new AcceptLanguage();
Expand Down

0 comments on commit cd52116

Please sign in to comment.