public function CookieJarTest::testUpdateFromSetCookieWithMultipleCookies in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/browser-kit/Tests/CookieJarTest.php \Symfony\Component\BrowserKit\Tests\CookieJarTest::testUpdateFromSetCookieWithMultipleCookies()
File
- vendor/
symfony/ browser-kit/ Tests/ CookieJarTest.php, line 92
Class
Namespace
Symfony\Component\BrowserKit\TestsCode
public function testUpdateFromSetCookieWithMultipleCookies() {
$timestamp = time() + 3600;
$date = gmdate('D, d M Y H:i:s \\G\\M\\T', $timestamp);
$setCookies = array(
sprintf('foo=foo; expires=%s; domain=.symfony.com; path=/, bar=bar; domain=.blog.symfony.com, PHPSESSID=id; expires=%s', $date, $date),
);
$cookieJar = new CookieJar();
$cookieJar
->updateFromSetCookie($setCookies);
$fooCookie = $cookieJar
->get('foo', '/', '.symfony.com');
$barCookie = $cookieJar
->get('bar', '/', '.blog.symfony.com');
$phpCookie = $cookieJar
->get('PHPSESSID');
$this
->assertInstanceOf('Symfony\\Component\\BrowserKit\\Cookie', $fooCookie);
$this
->assertInstanceOf('Symfony\\Component\\BrowserKit\\Cookie', $barCookie);
$this
->assertInstanceOf('Symfony\\Component\\BrowserKit\\Cookie', $phpCookie);
$this
->assertEquals('foo', $fooCookie
->getValue());
$this
->assertEquals('bar', $barCookie
->getValue());
$this
->assertEquals('id', $phpCookie
->getValue());
$this
->assertEquals($timestamp, $fooCookie
->getExpiresTime());
$this
->assertNull($barCookie
->getExpiresTime());
$this
->assertEquals($timestamp, $phpCookie
->getExpiresTime());
}