public function testToFile() { $cookie = new CurlCookie(); $cookie->open(uniqid(self::$name)); $cookie->add('PHPSESSID', '123456', '.test1.ru', '/', 0, true, false, true); $cookie->toFile($cookie->get('test1.ru')); $cookie2 = new CurlCookie(); $cookie2->open(uniqid(self::$name)); $cookie2->adds($cookie2->fromFile($cookie->getFileFormName())); $testCookie = $cookie2->get('test1.ru'); $this->assertTrue(is_array($testCookie)); $this->assertArrayHasKey('PHPSESSID', $testCookie); $this->assertArrayHasKey('value', $testCookie['PHPSESSID']); $this->assertEquals('123456', $testCookie['PHPSESSID']['value']); }
function __destruct() { curl_share_close($this->shareDescriptor); $this->cookie->deleteOldFiles(); }