namespace Symfony\Component\BrowserKit\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\BrowserKit\Cookie;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\BrowserKit\Response;
class CookieJarTest extends TestCase
{ 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'
);
} public function testExpire() {