Permalink
Browse files

Added test for empty-cookies removal

  • Loading branch information...
unixo committed Feb 4, 2014
1 parent f9a2553 commit 805b34a872cc768260cf3acacd9f22a024000871
Showing with 12 additions and 0 deletions.
  1. +12 −0 tests/Guzzle/Tests/Plugin/Cookie/CookieJar/ArrayCookieJarTest.php
@@ -350,4 +350,16 @@ public function testThrowsExceptionWithStrictMode()
'domain' => 'bar'
)));
}
public function testRemoveExistingCookieIfEmpty()
{
// first set a valid cookie
$validCookie = new Cookie(array('name' => 'foo', 'value' => 'bar', 'domain' => 'foo.com', 'path' => '/', 'discard' => false));
$this->assertTrue($this->jar->add($validCookie));
// then try to re-set the same cookie with no value: assert that cookie is not added
$emptyCookie = new Cookie(array('name' => 'foo', 'value' => NULL, 'domain' => 'foo.com', 'path' => '/', 'discard' => false));
$this->assertFalse($this->jar->add($emptyCookie));
// assert that original cookie has been deleted
$this->assertEquals(0, count($this->jar));
}
}

0 comments on commit 805b34a

Please sign in to comment.