Ejemplo n.º 1
0
 public function testSerializable()
 {
     $dt = new DateTime();
     $dt->setTimezone(new DateTimeZone('UTC'));
     $dt->modify('+1 day');
     $cookie = array('domain' => '.example.com', 'path' => '/', 'secure' => false, 'value' => 'foo');
     $this->jar->store($cookie + array('name' => 'session', 'expires' => null));
     $this->jar->store($cookie + array('name' => 'long', 'expires' => $dt->format(DateTime::COOKIE)));
     $newJar = unserialize(serialize($this->jar));
     $cookies = $newJar->getAll();
     $this->assertEquals(1, count($cookies));
     $this->assertEquals('long', $cookies[0]['name']);
     $this->jar->serializeSessionCookies(true);
     $newJar = unserialize(serialize($this->jar));
     $this->assertEquals($this->jar->getAll(), $newJar->getAll());
 }