public function testOverwritesCookiesThatHaveChanged() { $t = time() + 1000; $data = array('Name' => 'foo', 'Value' => 'bar', 'Domain' => '.example.com', 'Path' => '/', 'Max-Age' => '86400', 'Secure' => true, 'Discard' => true, 'Expires' => $t); // Make sure that the discard cookie is overridden with the non-discard $this->assertTrue($this->jar->setCookie(new puzzle_cookie_SetCookie($data))); $data['Value'] = 'boo'; $this->assertTrue($this->jar->setCookie(new puzzle_cookie_SetCookie($data))); $this->assertEquals(1, count($this->jar)); // Changing the value plus a parameter also must overwrite the existing one $data['Value'] = 'zoo'; $data['Secure'] = false; $this->assertTrue($this->jar->setCookie(new puzzle_cookie_SetCookie($data))); $this->assertEquals(1, count($this->jar)); $c = $this->jar->getIterator()->getArrayCopy(); $this->assertEquals('zoo', $c[0]->getValue()); }