You are here

public function CookieJarTest::testSetGet in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/browser-kit/Tests/CookieJarTest.php \Symfony\Component\BrowserKit\Tests\CookieJarTest::testSetGet()

File

vendor/symfony/browser-kit/Tests/CookieJarTest.php, line 20

Class

CookieJarTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testSetGet() {
  $cookieJar = new CookieJar();
  $cookieJar
    ->set($cookie = new Cookie('foo', 'bar'));
  $this
    ->assertEquals($cookie, $cookieJar
    ->get('foo'), '->set() sets a cookie');
  $this
    ->assertNull($cookieJar
    ->get('foobar'), '->get() returns null if the cookie does not exist');
  $cookieJar
    ->set($cookie = new Cookie('foo', 'bar', time() - 86400));
  $this
    ->assertNull($cookieJar
    ->get('foo'), '->get() returns null if the cookie is expired');
}