Skip to content

Commit

Permalink
Add test for ignoring expired cookies.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 24, 2017
1 parent 0f6dffd commit ea4951d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/TestCase/Http/Cookie/CookieCollectionTest.php
Expand Up @@ -225,4 +225,22 @@ public function testAddFromResponse()
'Has expiry'
);
}

/**
* Test adding cookies from a response ignores expired cookies
*
* @return void
*/
public function testAddFromResponseIgnoreExpired()
{
$collection = new CookieCollection();
$request = new ServerRequest([
'url' => '/app'
]);
$response = (new Response())
->withAddedHeader('Set-Cookie', 'test=value')
->withAddedHeader('Set-Cookie', 'expired=soon; Expires=Wed, 09-Jun-2012 10:18:14 GMT; Path=/; HttpOnly; Secure;');
$new = $collection->addFromResponse($response, $request);
$this->assertFalse($new->has('expired'),'Should drop expired cookies');
}
}

0 comments on commit ea4951d

Please sign in to comment.