/** * Check we can remove cookies and we can access their original values */ public function testForceExpiry() { //load an existing cookie $cookieJar = new CookieJar(array('cookieExisting' => 'i woz here')); //make sure it's available $this->assertEquals('i woz here', $cookieJar->get('cookieExisting')); //remove the cookie $cookieJar->forceExpiry('cookieExisting'); //check it's gone $this->assertEmpty($cookieJar->get('cookieExisting')); //check we can get it's original value $this->assertEquals('i woz here', $cookieJar->get('cookieExisting', false)); //check we can add a new cookie and remove it and it doesn't leave any phantom values $cookieJar->set('newCookie', 'i am new'); //check it's set by not received $this->assertEquals('i am new', $cookieJar->get('newCookie')); $this->assertEmpty($cookieJar->get('newCookie', false)); //remove it $cookieJar->forceExpiry('newCookie'); //check it's neither set nor received $this->assertEmpty($cookieJar->get('newCookie')); $this->assertEmpty($cookieJar->get('newCookie', false)); }