"flags" => 0,
"expires" => -1,
"path" => "",
- "domain" => ""
+ "domain" => "",
+ "max-age" => -1,
);
$this->assertEquals($a, $c->toArray());
$this->assertEquals($a, $o->toArray());
foreach (array($orig, $copy) as $c) {
$this->assertEquals("value", $c->getCookie("key"));
$this->assertEquals(-1, $c->getExpires());
+ $this->assertEquals(-1, $c->getMaxAge());
$this->assertEquals(0, $c->getFlags());
$this->assertEquals(null, $c->getPath());
$this->assertEquals(null, $c->getDomain());
"expires" => -1,
"path" => "",
"domain" => "",
+ "max-age" => -1,
),
$c->toArray()
);
);
}
+ function testMaxAge() {
+ $c = new http\Cookie("this=max-age; max-age=12345");
+ $this->assertEquals("max-age", $c->getCookie("this"));
+ $this->assertEquals(12345, $c->getMaxAge());
+ $o = clone $c;
+ $t = 54321;
+ $o->setMaxAge();
+ $this->assertEquals(-1, $o->getMaxAge());
+ $this->assertNotEquals(-1, $c->getMaxAge());
+ $o->setMaxAge($t);
+ $this->assertEquals($t, $o->getMaxAge());
+ $this->assertNotEquals($t, $c->getMaxAge());
+ $this->assertEquals(
+ "this=max-age; max-age=$t; ",
+ $o->toString()
+ );
+ }
+
function testPath() {
$c = new http\Cookie("this=has a path; path=/down; ");
$this->assertEquals("has a path", $c->getCookie("this"));