You are here

public function CookieJarTest::testUpdateFromSetCookie in Zircon Profile 8.0

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

File

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

Class

CookieJarTest

Namespace

Symfony\Component\BrowserKit\Tests

Code

public function testUpdateFromSetCookie() {
  $setCookies = array(
    'foo=foo',
  );
  $cookieJar = new CookieJar();
  $cookieJar
    ->set(new Cookie('bar', 'bar'));
  $cookieJar
    ->updateFromSetCookie($setCookies);
  $this
    ->assertInstanceOf('Symfony\\Component\\BrowserKit\\Cookie', $cookieJar
    ->get('foo'));
  $this
    ->assertInstanceOf('Symfony\\Component\\BrowserKit\\Cookie', $cookieJar
    ->get('bar'));
  $this
    ->assertEquals('foo', $cookieJar
    ->get('foo')
    ->getValue(), '->updateFromSetCookie() updates cookies from a Set-Cookie header');
  $this
    ->assertEquals('bar', $cookieJar
    ->get('bar')
    ->getValue(), '->updateFromSetCookie() keeps existing cookies');
}